3 Attachment(s)
how to auto scroll hscrollbar in C#
Hi Sir,
how to auto scroll my horizontal scroll bar when i click ok in message box ?
this is the concept of my simple game.
this is my level 1 interface, if the user get the correct answer ,dialog will appear "Correct"
Attachment 161315
when user click Ok , I want to move the Hscrollbar to show the next level.
Attachment 161317
show level 2 as below. how can i code that ?
Attachment 161319
if correct it will show messagebox and after click ok i want the scroll bar to move to 341 value to show the next LEVEL but it is not moving. please help me.
Code:
private void btnGuess_Click(object sender, EventArgs e)
{
if (lblRemember.Text == txtAnswer.Text)
{
MessageBox.Show("Correct");
newhscrollbar.Value = 341;
newhscrollbar.Maximum = 345;
newhscrollbar.Minimum = 0;
//Other condition
txtAnswer.Clear();
txtAnswer.Focus();
Generator();
lblRemember.Show();
lblLevel.Text = (int.Parse(lblLevel.Text) + 1).ToString();//increase level
Generator();
txtAnswer.Enabled = false;
}
Re: how to auto scroll hscrollbar in C#
Why are you asking hot to do something in C# in a VB.NET forum? This site has a C# forum so use that. I've asked the mods to move this thread.
For the record, I would have had a go at answering if it had been posted in the right place but I'm not going to look at the question until it's been moved.
Re: how to auto scroll hscrollbar in C#
Thread moved from the 'VB.Net' forum to the 'C#' forum
Re: how to auto scroll hscrollbar in C#
hi sir,
Sorry sir , Im new to this forum didn't notice that C# can be separated. please help me in my coding thank you.
Re: how to auto scroll hscrollbar in C#
I don't really understand why you're asking this question at all because the code you posted indicates that you already know how to set the position of the scroll bar handle. What is the actual issue? Also, have you read the documentation for the HScrollBar control? If you are using a new type then you should ALWAYS cast your eye over the documentation for that type to see what members it has and if there are any specific points of interest.