Help with Multiple Forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jenkins0706
    New Member
    • Mar 2007
    • 12

    #1

    Help with Multiple Forms

    I have created 3 forms that are supposed to request information from a Database.

    I am able to design the forms, and create the relevant code.

    Could someone help me to get the information from Form 2 for example.

    From Form 1 i can call up Forms 2 and 3. How do i get the info from Form 1 when i am in Form 2.

    I use Visual Basic 2005. ADO.Net

    I can give you more infor if you need it

    Thanks
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Greetings and salutations, jenkins0706!

    Have you tried searching here before hand?

    I must admit I do not too much about VB Express. But if you post your code here, skillful, and rather nice specialists here will be able to shed some light.

    If you need to search, try adding VB Expess, or VB 2005 to search terms then fire away.

    Good luck and welcome!

    Dököll

    Comment

    • jenkins0706
      New Member
      • Mar 2007
      • 12

      #3
      Hi

      This is the code for Form2

      Public Class Form2
      Public ds As New DataSet

      Private Sub ListBox1_Select edIndexChanged( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles lbxButter.Selec tedIndexChanged

      End Sub

      Private Sub ListBox2_Select edIndexChanged( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles lbxSummary.Sele ctedIndexChange d

      End Sub

      Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles cmbSpecies.Sele ctedIndexChange d

      End Sub

      Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnCalc.Click
      Dim Perc As Decimal

      'lbxRound.Items .Add((txbAddres s.Text) & " £ " & CDbl(cmbPrice.T ext) * CDbl(txbQty.Tex t) - CDbl(txbPaid.Te xt))
      Perc = CDec(CInt(CStr( CDbl(txb2005.Te xt) - CDbl(txb2000.Te xt))) / (CInt(CStr(CDbl (txb2000.Text)) ))) * 100

      'CInt(txbSpecie s.Text.Contains (

      lbxButter.Items .Add((txbSpecie s.Text) & Perc)
      End Sub


      End Class

      This is the part of the code from Form 1

      Private Sub btnForm2_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnForm2.Click
      Dim frmForm2 As New Form2

      frmForm2.Show()
      End Sub

      I am not able to access the txb2000 and txb2005 from Form1

      Help

      Thanks

      Comment

      • Dököll
        Recognized Expert Top Contributor
        • Nov 2006
        • 2379

        #4
        If you have done anything in VB 6.0, it's probable you are aware of setting visibility to either True or False. Does VB Express have these methods?

        Also try adding

        Code:
        Unload Me
        frmForm2.Show
        Should help unload Form1 then show Form2 if this is what you hope to achieve...you'd have to figure out if VB Express also have such a method.

        Comment

        • jenkins0706
          New Member
          • Mar 2007
          • 12

          #5
          Hi

          I am using VB 2005 and i am trying to obtain information from Form1 when i am in Form2.

          Any hints

          Thanks

          Comment

          • ansumansahu
            New Member
            • Mar 2007
            • 149

            #6
            Originally posted by jenkins0706
            Hi

            I am using VB 2005 and i am trying to obtain information from Form1 when i am in Form2.

            Any hints

            Thanks
            See if this link helps you out to pass data between forms.

            http://www.vbdotnethea ven.com/UploadFile/thiagu304/passdata1226200 6073406AM/passdata.aspx

            thanks
            ansuman

            Comment

            • Dököll
              Recognized Expert Top Contributor
              • Nov 2006
              • 2379

              #7
              Originally posted by jenkins0706
              Hi

              I am using VB 2005 and i am trying to obtain information from Form1 when i am in Form2.

              Any hints

              Thanks
              Did you try Unload Me?

              Comment

              Working...