Categories > Coding > C# >
How can i loop that code?
Posted
I want to make a loadbar in wpf. but its not a loadbar actually. It should goes right and left in a loop.
my dude entity 🤜🤛
https://cdn.discordapp.com/attachments/775762417618780193/978180264037593129/1653286667685.png
Replied
while (size is not like u want it)
{
border.width = border.width +5
}
sorry if this sint correct im on phone rn
Cancel
Post
back lol
my dude entity 🤜🤛
https://cdn.discordapp.com/attachments/775762417618780193/978180264037593129/1653286667685.png
Replied
@efewss no your probably just pasting code, not gonna spoon feed you but:
For loop
for (Statement 1; Statement 2; Statement 3)
{
//Code to execute
}
Foreach loop
foreach (type Variable in Array)
{
//Code to execute
}
While loop
while (Condition)
{
//code to execute
}
pretty straightforward.
Cancel
Post
https://media.discordapp.net/attachments/1010636204225601659/1012865624797610044/sKQybOLT.gif
Replied
all of the replies above do not answer your problem.
for (int I = 0; I < 101; I++)
this.ProgressBar.Value = I; /* or something */
how can I manually add progress? via method? with breaks?
void SetValue(ProgressBar Bar, int Value) {
for (int I = 0; I < Value + 1; I++)
Bar.Value = I;
}
SetValue(MyProgressBar, 100) /* This sets the progressbar's value to 100 percent, This can also be used for Width. */
Learn more about data types operators like what i used "<"
Question: Why did I use for loop? instead of just doing Value = 100?
Answer: if you want it to go smooth it would but remember for loop is fast so you could just like delay to make it even more smoother.
Cancel
Post
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post