VB.NET 2002/2003 BasicsFor coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I want to enter data from the database to the combobox whenever the tab gets selected or on click of tab
my code is down below
Private Sub frmTouristAttractions_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cmbevent.Items.Clear()
If tabattractions.Tag = 0 Then
Try
con.Open()
Dim strsql As String
Dim dt As New DataTable
strsql = "select event_name from Events_Info"
Dim dataadapter As New Odbc.OdbcDataAdapter(strsql, con)
dataadapter.Fill(dt)
dataadapter.Dispose()
con.Close()
For i = 0 To dt.Rows.Count - 1
cmbevent.Items.Add(dt.Rows(i)("event_name"))
Next i
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End If
If tabattractions.Tag = 1 Then
MsgBox("TAB 1")
End If
If tabattractions.Tag = 2 Then
MsgBox("TAB 2")
End If
End Sub
Please help me out with this
how should i put this code on click event of particular tag or whenver the tag gets selected .. because click event is not working
You should not be forcing other people to answer your question. The most obvious reason being that people would see it as an order and secondly, this is not the right forum for this question. May be a VB.NET-specific question. Dunno
Add click event for TabControl (note here it is not TabPage, TabControl is a collection of TabPage(s)) as follows to find which tabpage have been clicked.