|
-
Jul 30th, 2006, 08:44 PM
#1
Thread Starter
Member
tabcontrol problem!!!
I have create tabcontrol. and i have 3 tab pages. when i click on one of the tab page in the tabcontrol, i want the informatio of that particular tab page to be retreived from the database and display it on the screen. do u have the codes for that?? or can u somehow guide me inorder to achieve it???
-
Jul 30th, 2006, 09:27 PM
#2
Hyperactive Member
Re: tabcontrol problem!!!
You'll want to store all the information for all the tabs somehow. This could be in a list of the set of data you need stored (that set could be anything depending on what you're using it for... eg a list of where the controls on that tab are located, text from in a textbox, a listbox's list of items...).
When the user clicks a tab, you load the data for the appropiate tab.
Hope that helps
-
Jul 31st, 2006, 02:32 AM
#3
Thread Starter
Member
Re: tabcontrol problem!!!
can u show me the examples of the codes?
-
Jul 31st, 2006, 02:41 AM
#4
Hyperactive Member
Re: tabcontrol problem!!!
Only if you write it for me...
... alright... fine... start here or here... check google for more.
-
Jul 31st, 2006, 02:50 AM
#5
Thread Starter
Member
Re: tabcontrol problem!!!
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source =C:\temp\db1.mdb"
Dim con As OleDb.OleDbConnection
Dim dr As OleDb.OleDbDataReader
Dim cmd As New OleDb.OleDbCommand
Try
Dim strselect As String = "Select * from fine where fineType = '" & cbxtype.Text & "' And BorrowerId = '" & Form1.tbxID.Text & "'"
con = New OleDb.OleDbConnection(strcon)
'create a new connection
con = New OleDb.OleDbConnection(strcon)
con.Open()
cmd.Connection = con
cmd.CommandText = strselect
dr = cmd.ExecuteReader
If TabPage1.Text = "Lost" Then
lost.ShowDialog()
End If
While dr.Read()
Dim Item As New ListViewItem
Item.Text = (dr("fineId"))
Item.SubItems.Add(dr("itemId"))
Item.SubItems.Add(dr("itemTitle"))
Item.SubItems.Add(dr("dueDate"))
Item.SubItems.Add(dr("dateReturn"))
Item.SubItems.Add(dr("daysOverdue"))
TabControl1.Item.Add(Item)
End While
dr.Close()
Catch eException As Exception
MessageBox.Show(eException.Message)
End Try
End Sub
this is the codes. can u like help me to solve the codes??
-
Aug 1st, 2006, 01:56 AM
#6
Hyperactive Member
Re: tabcontrol problem!!!
 Originally Posted by twinkie
this is the codes. can u like help me to solve the codes??
This isn't the best way to ask that question. You need to specify what your problem is. Do you not understand the code? Is it not compiling? Is it not doing what you expect? If so, what is the problem? Is it giving an error? If so what is the error? ... The list goes on. I could be here a week guessing what you want, so please specify in more detail your question and I'll try if I can.
Also, please include what version of VB you are using in the title of the thread in future, because that makes a difference as well. What version are you using?
From the looks of it the code is accessing a database of some sort. If this is the case, I might not be the best person to help, but I can try anyway. Post back with a more specific question and we can try again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|