Combobox Focus

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2009
Posts: 13
Reputation: tmani_85 is an unknown quantity at this point 
Solved Threads: 2
tmani_85 tmani_85 is offline Offline
Newbie Poster

Combobox Focus

 
0
  #1
Feb 28th, 2009
I am setting focus to combobox as combobox.select() in a thread by using the delegate. But only after changing the ALT+TAB to another window the combobox is getting focused.

How to solve this problem...

Please help me...

Thanks in advance...

The code is here...
=============

Private Delegate Sub cmbusersetfocus()
Private Sub combouser()
If Me.InvokeRequired Then
' if operating on a thread, invoke a delegate
' on the UI thread.
Dim omd As cmbusersetfocus = New cmbusersetfocus(AddressOf combouser)
Dim arx As IAsyncResult = Me.BeginInvoke(omd)
Me.EndInvoke(arx)

If cmbuser.Focus = False Then

cmbuser.Select()

End If

'cmbuser.Focus()
'Form1.Activate()


' End If

'MsgBox("test")

Return

End If
End Sub
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Combobox Focus

 
0
  #2
Mar 1st, 2009
Did you try ComboBox.Focus()
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 13
Reputation: tmani_85 is an unknown quantity at this point 
Solved Threads: 2
tmani_85 tmani_85 is offline Offline
Newbie Poster

Re: Combobox Focus

 
0
  #3
Mar 2nd, 2009
yea I tried combobox.focus But it doesnt work for me...
Is there any other way to bring the focus back to combobox ..
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Combobox Focus

 
0
  #4
Mar 3rd, 2009
Put ComboBox.Select(); in the form_load event handler.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 13
Reputation: tmani_85 is an unknown quantity at this point 
Solved Threads: 2
tmani_85 tmani_85 is offline Offline
Newbie Poster

Re: Combobox Focus

 
0
  #5
Mar 3rd, 2009
Thanks.....

I don't need to focus the combobox not in the load... I need to do it after doing some process in thread...

After that a message box appears at the end of the thread... After clicking the ok button in the message box i need to focus the combobox...

At the end of the thread i need to focus it...
So i am using the delegate function to focus the combobox....

After going to some other window only it's get focusing...

When i do the ALT+TAB and go to some other window and when i come back to the form its getting focused....

Please help me....
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 990 | Replies: 4
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC