Results 1 to 6 of 6

Thread: tabcontrol problem!!!

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    58

    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???

  2. #2
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    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
    * Don't limit yourself to sanity
    * I'd rather be optimistic and naive than pessimistic and right
    * Ask good questions, get good answers.

    My Codebank submissions:
    How to write one rountine to handle many events
    Accessing and Using variables across multiple forms
    Printing/Previewing a form or control

    Links I've "borrowed" from other people:
    vbdotnetboy - Awesome site for tips

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    58

    Re: tabcontrol problem!!!

    can u show me the examples of the codes?

  4. #4
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    Re: tabcontrol problem!!!

    Only if you write it for me...

    ... alright... fine... start here or here... check google for more.
    * Don't limit yourself to sanity
    * I'd rather be optimistic and naive than pessimistic and right
    * Ask good questions, get good answers.

    My Codebank submissions:
    How to write one rountine to handle many events
    Accessing and Using variables across multiple forms
    Printing/Previewing a form or control

    Links I've "borrowed" from other people:
    vbdotnetboy - Awesome site for tips

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    58

    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??

  6. #6
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    Re: tabcontrol problem!!!

    Quote 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
    * Don't limit yourself to sanity
    * I'd rather be optimistic and naive than pessimistic and right
    * Ask good questions, get good answers.

    My Codebank submissions:
    How to write one rountine to handle many events
    Accessing and Using variables across multiple forms
    Printing/Previewing a form or control

    Links I've "borrowed" from other people:
    vbdotnetboy - Awesome site for tips

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width