•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 391,609 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,620 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser:
Views: 313 | Replies: 2 | Solved
![]() |
•
•
Join Date: Jun 2008
Posts: 16
Reputation:
Rep Power: 1
Solved Threads: 0
In my forms I have a tab control containing two pages, in tabpage1 (list view) tabpage2 (gridview) and a several buttons. my problem now is how to know that if the user hit a button then locate the active control or tabpage eaither tabpage1 or tabpage2. I intent that the user chosen either the tabpage1 or tabpage2 then click the ok button, after click the ok button then I want to know the previous active control or tabpage. Please help me
I am a newbie with this environment, I am using vb 2005. I have no other resources but only this forums. I have read some help and tutorial but sometimes very hard to understand
Thanks a lot
I am a newbie with this environment, I am using vb 2005. I have no other resources but only this forums. I have read some help and tutorial but sometimes very hard to understand
Thanks a lot
•
•
Join Date: Dec 2002
Location: West Virginia
Posts: 368
Reputation:
Rep Power: 6
Solved Threads: 34
Use a variable to keep track of the last tab clicked. I used a tab control with two tabs, a button on each page and a button on the form. Here is the code:
Public Class Form1
Dim TabPage As Integer = 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Select Case TabPage
Case 1
Button2.PerformClick()
Case 2
Button3.PerformClick()
End Select
End Sub
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
Dim tc As TabControl = sender
Dim txt As String = tc.SelectedTab.ToString
If txt.IndexOf("{TheFirstPageText") > -1 Then
TabPage = 1
Else
TabPage = 2
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MessageBox.Show("Button 2 clicked")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
MessageBox.Show("Button 3 clicked")
End Sub
End Class Wayne
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
Similar Threads
- Forms in Random access files (Visual Basic 4 / 5 / 6)
- Why won't this code work? (VB.NET)
- hangman revised (VB.NET)
- Forms authorization, only want a few links (ASP.NET)
- Identification of Web Forms (ASP.NET)
- Scrolling MDI Child form (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
- Previous Thread: Voice Recognition
- Next Thread: Calculate File Size on Disk in KB


Linear Mode