Announcement

Collapse
No announcement yet.

How can help me with VB project ??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can help me with VB project ??

    need to know how to get data from my database (excel or access ) and put it in to combo box?


    any ideas
    Love
    Nick :twisted:

  • #2
    Use the wizard to do ya shit..read up on tutorials..thats what I did..I think you need to make a table to gather ya data in combo box..this is old skewl stuff which I can't remember :?

    Comment


    • #3
      u can do it heaps of ways.

      Here's how you grab data from excel using wscript. Stolen from msdn.microsoft.com, saw it today while looking for something else

      ' -------------------------------------------------------------
      ' Start the Excel Worksheet reading

      ' Bind to an Excel worksheet object
      Set objXL = WScript.CreateObject("EXCEL.application")


      ' Make it visible
      'objXL.Visible = True

      ' Open the desired workbook containing the users list
      objXL.workbooks.open strExcelSheetPath

      ' Activate the named page "Export"
      objXL.sheets("Export").Activate

      ' Put the cursor on the A2 cell
      objXL.ActiveSheet.range("A2").Activate

      Once the range has been returned, the script can iterate through the row in the range and pull the user information from each cell in the row:

      ' Until we run out of rows
      Do While objXL.activecell.Value <> ""

      ' -----------------------------------------------------
      ' Parameters for the user's mailbox creation under LDAP: namespace
      strFirstName = objXL.activecell.offset(0, 0).Value
      strLastName = objXL.activecell.offset(0, 1).Value
      '... More extraction of info here see the script for exact details

      in the above loop is where you'd stick the shit into a combo box.


      for an access db you'd use ADO. Look it up.. pretty straight forward

      lots of examples in the vb helpfiles, and on the net.

      if you can't be bothered, a good resource for stealing code is www.pscode.com

      cya

      Comment


      • #4
        thanks heaps

        do u know how to put the vba form into the main window of excel ?

        so when u open a spreadsheat u get the form ?

        possible ?
        Love
        Nick :twisted:

        Comment


        • #5
          I take it you are doing Visual Programming, using some twisted course notes originally formed for VB4 and occasionally updated for VB .NET.

          Check out the MSDN esp the DR GUI .NET tutorials, there is some good stuff in there.

          Comment


          • #6
            narh im doing a database project
            Love
            Nick :twisted:

            Comment


            • #7
              if you can't be bothered, a good resource for stealing code is www.pscode.com  
              U da man

              narh im doing a database project
              databases ..... eeeeeewwww. Better you than me. Goodluck!

              Comment


              • #8
                Fuck me, looks like I'm reading slashdot.org (news for nerds!)
                mmmmm sacrilicious

                Comment


                • #9
                  Fuck me, looks like I'm reading slashdot.org (news for nerds!)
                  Nah... This place ain't got anything on that site... They can REALLY talk about shit that don't matter....
                  Aim high and consider yourself worthy of great things

                  Comment


                  • #10
                    thanks heaps

                    do u know how to put the vba form into the main window of excel ?  

                    so when u open a spreadsheat u get the form ?

                    possible ?
                    yeah..
                    from excel:
                    open the workbook that u wanna work on..
                    go tools->macro->visual basic editor
                    look in the project pane in the left.
                    Assuming you've already created the form it should show up under a forms folder. otherwise right click on the project pane and click insert -> userform.
                    Anyway, double click on the 'This workbook' icon thingo in the left hand project pane so it brings up the code window.

                    Above the code window there should be 2 drop down boxes.
                    On the left one select 'workbook', on the right one select 'open'.
                    That should automatically create a sub that looks like this

                    Private Sub Workbook_Open()

                    End Sub

                    then you just gotta add the form show line
                    eg

                    Private Sub Workbook_Open()
                    UserForm1.Show
                    End Sub

                    where userform1 = the name of your form
                    Assuming macro security level is medium or low and you enable macros, that should show up when you open the workbook.

                    cya

                    Comment

                    Working...
                    X