sudhakar_koundinya
asked on
Combobox: How to set the position to desired index
Hi all,
I have a handle to combox box(this is from external application- App A).
Now I want to set the value to desired position using my application(App - B)
How can I do this??
Thanks
Sudhakar
I have a handle to combox box(this is from external application- App A).
Now I want to set the value to desired position using my application(App - B)
How can I do this??
Thanks
Sudhakar
Tell me, to select an item in it, you have the position number or text.
ASKER
Text is preferred
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const CB_SELECTSTRING = &H14D
Private Sub Command1_Click()
Dim hCombo As Long
Let hCombo = Combo1.hwnd
If SendMessage(hCombo, CB_SELECTSTRING, -1, ByVal "World") = 0 Then
MsgBox "Not Found"
End If
End Sub
Private Sub Form_Load()
Call Combo1.AddItem("Hello")
Call Combo1.AddItem("World")
Call Combo1.AddItem("Rubyn")
End Sub
Put one Combo and Command on a form and paste the code
Want any help inform me :)
Private Const CB_SELECTSTRING = &H14D
Private Sub Command1_Click()
Dim hCombo As Long
Let hCombo = Combo1.hwnd
If SendMessage(hCombo, CB_SELECTSTRING, -1, ByVal "World") = 0 Then
MsgBox "Not Found"
End If
End Sub
Private Sub Form_Load()
Call Combo1.AddItem("Hello")
Call Combo1.AddItem("World")
Call Combo1.AddItem("Rubyn")
End Sub
Put one Combo and Command on a form and paste the code
Want any help inform me :)
ASKER
Ok thanks,
It seems I am facing some problem with text selection. May I have an exampple based on index??
If that works, I will change my logic accoringly
Thanks
Sudhakar
It seems I am facing some problem with text selection. May I have an exampple based on index??
If that works, I will change my logic accoringly
Thanks
Sudhakar
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great Help. :-)
ASKER
Actually I am working with Office Outlook 2003 project. And I am facing some problems
So, in order to resolve these problems, I need to use Win API's Message Sending procedures.
As of now I have tested this with MFC- VB Communication.
When I am at work place, will test the same with 2003. If I get any problems, I will post new queries here. And I hope you will be there to help me.
Thanks Again
Regards
Sudhakar
So, in order to resolve these problems, I need to use Win API's Message Sending procedures.
As of now I have tested this with MFC- VB Communication.
When I am at work place, will test the same with 2003. If I get any problems, I will post new queries here. And I hope you will be there to help me.
Thanks Again
Regards
Sudhakar
ASKER
Private Declare Function DlgDirSelectComboBoxEx Lib "user32" Alias "DlgDirSelectComboBoxExA" (ByVal hWndDlg As Long, ByVal lpszPath As String, ByVal cbPath As Long, ByVal idComboBox As Long) As Long
But facing problem
Could you please help me??
Thanks
sudhakar