Results 1 to 23 of 23

Thread: [RESOLVED] How To Load In Combo Box ?

  1. #1

    Thread Starter
    Lively Member _-Rs-_'s Avatar
    Join Date
    Aug 2009
    Posts
    84

    Resolved [RESOLVED] How To Load In Combo Box ?

    Hay All I Want To Learn
    How To Load In Combo Box Well I Am learning Web Browser in vb
    So I Come Up With A Web Page That has Some Like This
    Code:
          <select name="cons">
            
            <option value=starts>Starts With</option>
            <option value=contains>Contains</option>
            <option value=exactly>is Exactly</option>
    </select>
    option to choose so What I Want To No is How Do You Make "Starts With And Contains" Ect... Load In Combo Box And Wen I choose In My Combo Box My App Will Do It In Web Browser :
    Last edited by _-Rs-_; Sep 9th, 2009 at 10:17 AM. Reason: RESOLVED

  2. #2
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    Re: How To Load In Combo Box ?

    if u mean on a form...

    cboControl.AddItem "Male"
    cboControl.additem "Female"
    Wayne

  3. #3
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    Re: How To Load In Combo Box ?

    also.... you know if you want to pass the info to a web page, you can do it using the POST command of the webbrowser - so you have no HTML requirements to get the input, and dont nesecarily need to use a web browser either... you can use an Internet transfer control to just post the info to a server, and get a response... - FYI
    Wayne

  4. #4

    Thread Starter
    Lively Member _-Rs-_'s Avatar
    Join Date
    Aug 2009
    Posts
    84

    Re: How To Load In Combo Box ?

    Hay All I Found Out How To Add In Combo Box I Used AddItem But I Still Dont No How To Set It's value

  5. #5

    Thread Starter
    Lively Member _-Rs-_'s Avatar
    Join Date
    Aug 2009
    Posts
    84

    Re: How To Load In Combo Box ?

    I Think It Needs To Be Some Thing Like This

    vb Code:
    1. If Combo1.Text = "Starts With" Then
    2. ???????? (cons).Value = starts

    I Dont No If It's Right But I Think The Code Maybe Some Thing Like That

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: How To Load In Combo Box ?

    What is "cons" ?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  7. #7

    Thread Starter
    Lively Member _-Rs-_'s Avatar
    Join Date
    Aug 2009
    Posts
    84

    Question Re: How To Load In Combo Box ?

    Quote Originally Posted by koolsid View Post
    What is "cons" ?
    This Bro
    --------> <select name="cons"> <--------
    See The Html Source

  8. #8
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: How To Load In Combo Box ?

    try
    wb.document.all("cons").value = combo1.text
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  9. #9
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: How To Load In Combo Box ?

    Yeah I saw that... but what is it?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  10. #10

    Thread Starter
    Lively Member _-Rs-_'s Avatar
    Join Date
    Aug 2009
    Posts
    84

    Question Re: How To Load In Combo Box ?

    Quote Originally Posted by westconn1 View Post
    try
    wb.document.all("cons").value = combo1.text
    Not Working Bro
    Ok Here's More Info
    See This Link https://in.edit.yahoo.com/registration?
    It registration For Yahoo Id Now I make A Test Tool Like
    This http://i30.tinypic.com/2ekhurl.jpg
    at The Yahoo Page It's Asking For Gender Now I select Male In My Tool How Can I Make My Tool Do It In web browser Html Soure Is
    Code:
    <select name="gender" id="gender" class="" tabindex="3">
    	<option value="" SELECTED >- Select One -</option>
    
    	<option value="m"  >Male</option>
    
    	<option value="f"  >Female</option></select>
    Last edited by _-Rs-_; Sep 9th, 2009 at 06:04 AM.

  11. #11
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How To Load In Combo Box ?

    This has nothing to do with VB6 - Moved to HTML

  12. #12
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: How To Load In Combo Box ?

    this works in the yahoo
    wb.document.all("gender").Value = "f"
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  13. #13
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: How To Load In Combo Box ?

    @ hack
    maybe vb6, he is using webbrowser control
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  14. #14
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    Re: How To Load In Combo Box ?

    i'll expand on westconn's post for you

    if you want to set the form value then...

    Code:
    dim sSelectedWebbrowserText as string
    
    sSelectedWebbrowserText = WEBBROWSERCONTROLNAME.document.all("cons").value
    
    dim i as integer
    for i = 0 to FORMCOMBONAME.listcount-1
      if FORMCOMBONAME.List(i) = sSelectedWebbrowserText then
             FORMCOMBONAME.Listindex = i
             exit for ' we have found the next, exit the loop to speed things on
      end if
    next i
    not too sure with the web browser one... - but can you explain why you want to set the web browser types on your project if your using a form as a gui? - there are some instances you wanna do it, but like i said, its not always the best way... just slows things down

    for some reason since i installed IE 8 i cant actually use my web brwser control - jst errors out on me - so cant really give much info... but:

    i believe that something like

    WEBBROWSERCONTROLNAME.document.all("cons").list("VALUE").selected = true

    but im not too certain sry
    Wayne

  15. #15

    Thread Starter
    Lively Member _-Rs-_'s Avatar
    Join Date
    Aug 2009
    Posts
    84

    Question Re: How To Load In Combo Box ?

    thanks for All The Info Guys but As I Said I Am Newbie Here What I Really Want Is
    One Of My friend Asked Me To Try To Make A Tool That Will Search Here
    http://www.apcentralpower.com/search/search_hyd2.jsp
    So I Posted A Post Here
    http://www.vbforums.com/showthread.php?t=583275
    I Used That Info In My Tool All Was Ok But Not The Combo In That Page i Had No Idea How To Put That Combo Box In My Tool
    The Html Source i Put In This Post is From That Page
    So Guys What Should I Do If
    possible Please explain in detail

    I tried Some Thing Like This
    vb Code:
    1. Private Sub Combo2_Change()
    2. If Combo2.Text = "Starts With" Then
    3. WebBrowser1.Document.All(cons).Value = starts
    4. ElseIf Combo2.Text = "Contains" Then
    5. WebBrowser1.Document.All(cons).Value = contains
    6. ElseIf Combo2.Text = "is Exactly" Then
    7. WebBrowser1.Document.All(cons).Value = exactly
    8. End Sub
    But It Did not Work
    Last edited by _-Rs-_; Sep 9th, 2009 at 07:21 AM.

  16. #16
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: How To Load In Combo Box ?

    they are strings, not variables
    WebBrowser1.Document.All(cons).Value = "starts"
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  17. #17

    Thread Starter
    Lively Member _-Rs-_'s Avatar
    Join Date
    Aug 2009
    Posts
    84

    Re: How To Load In Combo Box ?

    [B]
    Quote Originally Posted by westconn1 View Post
    they are strings, not variables
    WebBrowser1.Document.All(cons).Value = "starts"
    Newbie Here Bro I Understand they are strings Now What Do I Do With Them
    Sorry If I Am taking Too Much Time Of Yours Guys
    Last edited by _-Rs-_; Sep 9th, 2009 at 08:49 AM.

  18. #18
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    Re: How To Load In Combo Box ?

    Quote Originally Posted by _-Rs-_ View Post
    One Of My friend Asked Me To Try To Make A Tool That Will Search Here
    http://www.apcentralpower.com/search/search_hyd2.jsp

    WebBrowser1.Document.All("cons").Value = "starts"

    -- again psting back to my origional point above... you realise that you can use the web browser post vars in the navigate sub of the browser to post your values, without needing to load the origional search page????
    Wayne

  19. #19
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    Re: How To Load In Combo Box ?

    Quote Originally Posted by _-Rs-_ View Post

    Newbie Here Bro Ok I Understand they are strings Now What Do I Do With Them Ware To Put Code In Private Sub Combo2_Change Or Command1_Click Or Form_Load
    i would use the combo Validate... - this runs when the control focus is lost...
    Wayne

  20. #20

    Thread Starter
    Lively Member _-Rs-_'s Avatar
    Join Date
    Aug 2009
    Posts
    84

    Smile Re: How To Load In Combo Box ?

    Quote Originally Posted by wpearsall View Post
    i would use the combo Validate... - this runs when the control focus is lost...
    combo Validate Hmmm Bro Can You Make An example Source
    With That Site http://www.apcentralpower.com/search/search_hyd2.jsp
    It will Give Me A Good Idea About What Your Saying

    peace

  21. #21
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    Re: How To Load In Combo Box ?

    Code:
    
        Dim strFormData As String
        
        'Length of the separator string must be 76.  I think this is simply a limitation of the component I was using and not a rule.
        strFormData = "-------------------------------------------------------------ZkdOkkdKjoHEEdZ" & vbCrLf
        
        strFormData = strFormData & "Content-Disposition: form-data; name=""cons""" & vbCrLf
        strFormData = strFormData & vbCrLf   'Extra carriage return before contents of multipart section
        strFormData = strFormData & sCons & vbCrLf
        
        strFormData = strFormData & "-------------------------------------------------------------ZkdOkkdKjoHEEdZ" & vbCrLf
        strFormData = strFormData & "Content-Disposition: form-data; name=""nameasonbill""" & vbCrLf
        strFormData = strFormData & vbCrLf   'Extra carriage return before contents of multipart section
        strFormData = strFormData & txtNames.Text & vbCrLf
        
        strFormData = strFormData & "-------------------------------------------------------------ZkdOkkdKjoHEEdZ" & vbCrLf
        strFormData = strFormData & "Content-Disposition: form-data; name=""ero""" & vbCrLf
        strFormData = strFormData & vbCrLf   'Extra carriage return before contents of multipart section
        strFormData = strFormData & sAreaNo & vbCrLf
        
        strFormData = strFormData & "-------------------------------------------------------------ZkdOkkdKjoHEEdZ" & vbCrLf
    
    
    WebBrowser1.Navigate URL, , , , strFormData, _
                    "Content-Type: multipart/form-data; " & _
                    "boundary=-----------------------------------------------------------ZkdOkkdKjoHEEdZ"

    if i give you this.... - its not the WHOLE thing, but you can add the fields you need, and need to get the POST URL.. - im not sure if its working, but i used that to send a form to login to my website from an old chat client i made... but my web browser is broke so
    Wayne

  22. #22
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    Re: How To Load In Combo Box ?

    Quote Originally Posted by _-Rs-_ View Post


    combo Validate Hmmm Bro Can You Make An example Source
    With That Site http://www.apcentralpower.com/search/search_hyd2.jsp
    It will Give Me A Good Idea About What Your Saying

    peace
    Code:
    Private Sub Combo1_Validate(Cancel As Boolean)
        Select Case Combo1.ListIndex
            Case 0:
                WebBrowser1.Document.All("cons").Value = "starts"
                
            Case 1:
                WebBrowser1.Document.All("cons").Value = "contains"
            
            Case 2:
                WebBrowser1.Document.All("cons").Value = "exactly"
            
        End Select
    End Sub
    Wayne

  23. #23

    Thread Starter
    Lively Member _-Rs-_'s Avatar
    Join Date
    Aug 2009
    Posts
    84

    Smile Re: How To Load In Combo Box ?

    Quote Originally Posted by wpearsall View Post
    Code:
    Private Sub Combo1_Validate(Cancel As Boolean)
        Select Case Combo1.ListIndex
            Case 0:
                WebBrowser1.Document.All("cons").Value = "starts"
                
            Case 1:
                WebBrowser1.Document.All("cons").Value = "contains"
            
            Case 2:
                WebBrowser1.Document.All("cons").Value = "exactly"
            
        End Select
    End Sub
    Thank You So Much Bro It Worked Keep Rocking
    Last edited by _-Rs-_; Sep 9th, 2009 at 10:19 AM.

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