Morning,
ive created 4 new tabs in the ultratabcontrol. Through VB.NET code how do i get to the next tab using a next button?
ultratabcontrol.selectedtab = ??????
ta
Hello misterRafter,
I am not sure what do you mean by "Next Button" , is this part of your UltraTab control or this is kind of stand alone button?
If you need programatically do select any tab from your UltraTab control you could use one of the below approaches:
ultraTabControl1.SelectedTab = ultraTabControl1.Tabs(3) ultraTabControl1.Tabs(2).Selected = true
Basically ive got a NEXT button outside the tabcontrol so it will allow me to go to the next tab.
i used this bit, works fine in the button click event.
ultraTabControl1.Tabs(2).Selected = true
now i need to work out a way to make the next button work for all tabs without creating seperate buttons
Came across this when looking for something. Your code above does not work if any of the tabs are invisible as the selected tab becomes nothing so it crashes when checking the index. It also don't work right well even if it did not crash because you end up on the hidden tab being selected, rather than the next non-hidden task.
Here is what I suggest.
Public Sub btnNext_Click(sender As System.Object, e As System.EventArgs) Handles btnNext.Click
Dim visInd As Integer
visInd = uTabOptions.ActiveTab.VisibleIndex
Do
visInd += 1
uTabOptions.SelectedTab = uTabOptions.Tabs(visInd)
Loop Until uTabOptions.SelectedTab IsNot Nothing Or visInd >= uTabOptions.Tabs.Count
End Sub
Public Sub btnback_Click(sender As System.Object, e As System.EventArgs) Handles btnback.Click
visInd -= 1
Loop Until uTabOptions.SelectedTab IsNot Nothing Or visInd <= 0
Hello MisterRafter,
I am glad that I was able to assist you here.
Please feel free to let us know if you have any other questions in the future.
Danko thanks,
i did convert your code into vb.net and got it to run. Thanks for your code explanation, all makes sense now.
love this place always very helpful.
Here is the same code in VB :
Private Sub UltraButton1_Click(sender As System.Object, e As System.EventArgs) Handles UltraButton1.Click If UltraTabControl1.SelectedTab IsNot Nothing AndAlso UltraTabControl1.SelectedTab.Index + 1 < UltraTabControl1.Tabs.Count Then UltraTabControl1.Tabs(UltraTabControl1.SelectedTab.Index + 1).Selected = True End If End Sub
perfect that works. Star! thanks
now i need to understand the code you provided. Im fairly new to VB.net :)