Results 1 to 12 of 12

Thread: auto complete textbox

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Unhappy auto complete textbox

    hi again
    I am programming my own Internet Explorer .I got stuck in the begining of all . I want to make auto complete addressbar , how can I do that ?
    a lot of thanx
    Last edited by Pirate; Nov 12th, 2002 at 08:19 PM.

  2. #2

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    any idea???

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Add items to the list when the user presses enter and as they type search the list for matches.

  4. #4

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    this sounds slow ,
    Is there a "WebBrowser" object in vb.net ???VB6 used to have one.
    oooh thanx

  5. #5

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Sorry I mean "WebBrowser" Control ???

  6. #6
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    You can use COM Interop and just set a reference to the webbrowser component through the references.

  7. #7

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Can you direct me where can I find that control in IDE VB.NET??

  8. #8

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    **** , it's more than an hour just to find that damn control

    thanx a lot guys for your replies

  9. #9
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Here is your answer, but you probably have found it by now.

    Right click on your toolbox, select Customize Toolbox...

    In the COM tab, you should find it and check it. Click OK.

    It should now be at the bottom of your toolbox.

  10. #10

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    thanx every1 for the help but the main question is still unresolved , which is the auto complete addressbar in the browser ????

  11. #11
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I found this at Planet Source Code.
    http://www.Planet-Source-Code.com/vb...=188&lngWId=10

    VB Code:
    1. Const CB_SHOWDROPDOWN = &H14F
    2.     Const CB_FINDSTRING = &H14C
    3.     Const CB_GETLBTEXTLEN = &H149
    4.     Const CB_GETDROPPEDWIDTH = &H15F
    5.     Const CB_SETDROPPEDWIDTH = &H160
    6.  
    7.     Private Declare Function LockWindowUpdate Lib "user32" (ByVal hWndLock As System.IntPtr) As Long
    8.  
    9.     Private Structure SIZE
    10.         Dim cx As Long
    11.         Dim cy As Long
    12.     End Structure
    13.  
    14.     Public Sub LockWindow(ByVal hwnd As System.IntPtr)
    15.         Dim lRet As Long
    16.         lRet = LockWindowUpdate(hwnd)
    17.     End Sub
    18.     Private Sub ReleaseWindow()
    19.         Dim lRet As Long
    20.         lRet = LockWindowUpdate(Nothing)
    21.     End Sub
    22.  
    23.     Private Sub ComboDropdown(ByRef comboObj As ComboBox)
    24.         Call SendMessage(comboObj.Handle, CB_SHOWDROPDOWN, 1, 0&)
    25.     End Sub
    26.     Private Sub ComboRetract(ByRef comboObj As ComboBox)
    27.         Call SendMessage(comboObj.Handle, CB_SHOWDROPDOWN, 0, 0&)
    28.     End Sub
    29.  
    30.     Public Function ComboAutoComplete(ByRef comboObj As ComboBox) As Boolean
    31.         Dim lngItemNum As Long
    32.         Dim lngSelectedLength As Long
    33.         Dim lngMatchLength As Long
    34.         Dim strCurrentText As String
    35.         Dim strSearchText As string
    36.         Dim sTypedText As String
    37.         Const CB_LOCKED = &H255
    38.         Try
    39.             With (comboObj)
    40.                 If .Text = Nothing Then
    41.                     Exit Function
    42.                 End If
    43.                 Call LockWindow(.Handle)
    44.                 If ((InStr(1, .Text, .Tag, vbTextCompare) <> 0 And Len(.Tag) = Len(.Text) - 1) Or (Left(.Text, 1) <> Left(.Tag, 1) And .Tag <> Nothing)) And .Tag <> CStr(CB_LOCKED) Then
    45.                     'If ((InStr(.Text, .Tag) <> 0) Or (.Tag <> Nothing) And .Tag <> CStr(CB_LOCKED)) Then
    46.                     'Dim strSearchText() As Object = {.Text}
    47.                     strSearchText = .Text
    48.                     lngSelectedLength = Len(strSearchText)
    49.  
    50.                     'lngItemNum = SendMessage(.Handle, CB_FINDSTRING, -1, .Text.ToCharArray)
    51.                     lngItemNum = .FindString(strSearchText)
    52.                     ComboAutoComplete = Not (lngItemNum = -1)
    53.  
    54.                     If ComboAutoComplete Then
    55.                         'lngMatchLength = Len(.Items.Item(lngItemNum))
    56.                         '.Tag = CB_LOCKED
    57.                         'sTypedText = strSearchText
    58.                         '.Text = .Text & Right(.Items.Item(lngItemNum), lngMatchLength)
    59.                         '.Tag = sTypedText
    60.                         '.SelectionStart = lngSelectedLength
    61.                         '.SelectionLength = lngMatchLength
    62.                         lngMatchLength = Len(.Items.Item(lngItemNum)) - lngSelectedLength
    63.                         '  If lngMatchLength <> lngSelectedLength Then
    64.                         .Tag = CB_LOCKED
    65.                         sTypedText = strSearchText
    66.                         .Text = .Text & Right(.Items.Item(lngItemNum), lngMatchLength)
    67.                         'strSearchText = .Items.Item(lngItemNum)
    68.                         .SelectionStart = lngSelectedLength
    69.                         Dim Temp As Integer
    70.                         Temp = lngMatchLength
    71.                         .SelectionLength = Temp
    72.                         '.Text = .Text & Right(.Items.Item(lngItemNum), lngMatchLength)
    73.                         .Tag = sTypedText
    74.                         '.Text = strSearchText
    75.                         'Else
    76.                         ' End If
    77.                     ' .SelectionStart = Len(.Tag)
    78.                     ' .SelectionLength = .Text.Length - Len(.Tag)
    79.                     'End If
    80.                 End If
    81.                 ElseIf .Tag <> CStr(CB_LOCKED) Then
    82.                 .Tag = .Text
    83.                 End If
    84.                 Call ReleaseWindow()
    85.             End With
    86.         Catch err As Exception
    87.             MsgBox(err.Message & err.StackTrace)
    88.         End Try
    89.     End Function

  12. #12

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    thanx for that LONG way . Is there another tricky code to solve that ????

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