473,899 Members | 4,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

combobox box - If Asc(e.KeyChar) = Keys.Enter Then textbox2.Focus( ) NOT WORKING

18 New Member
Private Sub combobox1_KeyPr ess(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles cmbcombobox1.Ke yPress
If Asc(e.KeyChar) = Keys.Enter Then
textbox2.Focus( )
End If
End Sub

i want just press enter key to go to the next textbox2 after selecting combobox1, but it's not working. it works fine for for navigating through textboxes, but not for combobox, Please help.
Aug 22 '07 #1
7 10851
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
Private Sub combobox1_KeyPr ess(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles cmbcombobox1.Ke yPress
If Asc(e.KeyChar) = Keys.Enter Then
textbox2.Focus( )
End If
End Sub

i want just press enter key to go to the next textbox2 after selecting combobox1, but it's not working. it works fine for for navigating through textboxes, but not for combobox, Please help.
Use the KeyDown event of the form...(make sure that it does not conflict with the control.KeyDown )
and
Expand|Select|Wrap|Line Numbers
  1. if (e.KeyData == Keys.Enter)
  2. {
  3.   this.processTabKey(true);
  4. }
If your control acts funny with this then implement the following code in the contol.keyDown even
Expand|Select|Wrap|Line Numbers
  1. if (e.KeyData == Keys.Enter)
  2. {
  3.   e.Handeled = true;
  4. }
Aug 22 '07 #2
tekeste
18 New Member
Thanks Shashi Sadasivan but it's not working in either. any other solution you can suggest?
Aug 22 '07 #3
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
Thanks Shashi Sadasivan but it's not working in either. any other solution you can suggest?
Have you set the Form.KeyPreview property to true?
- Shashi
Aug 22 '07 #4
tekeste
18 New Member
Thanks for ur fast reply Shashi but my form doesn't have keyPreview property since it is created using smart devices application using vb.net . what can I do??
Aug 22 '07 #5
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
Thanks for ur fast reply Shashi but my form doesn't have keyPreview property since it is created using smart devices application using vb.net . what can I do??
Hi,
Well...i have not used .net for mobile applications and am not able to reproduce it. From what I did see is that you are using a smartPhone device application. that dose not have KeyPreview, but pocketPC applications do.
Good luck
Aug 22 '07 #6
tekeste
18 New Member
Shashi, It's windows CE .Net v2.40. it doesn't have key preview property at all
Aug 23 '07 #7
Plater
7,872 Recognized Expert Expert
you should be able to manually focus the control, even in winCE.

In your keydown function, inside your if statement that matches the enter key:

Expand|Select|Wrap|Line Numbers
  1. if (e.KeyData == Keys.Enter)
  2. {
  3.    mytextbox2.focus();
  4. }
  5.  
You should check to make sure that the "Enter" key on the mobile device actually fires down a Keys.Enter. if you are not sure, have it display the key that is pressed and then hit enter to find out what it sends
Aug 23 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
11370
by: Ed Stewart | last post by:
Hello. I'm creating an application that requires user input into a ComboBox, and I'd like to have the cursor appear in this emtpy ComboBox when the application starts. I had a plain TextBox, and the cursor started there automatically; to implement a history feature, I've moved to a ComboBox, but now the user needs to click on it before typing. How do I set focus on this item? I've tried adding a null string and calling comboBox.Focus()...
6
2687
by: Harry | last post by:
I highlight the background colour of a textbox when it has focus, is there a way to do this for the combobox eg cmbMortgage.BackColor = Color.Red;
3
6841
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article: http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx I have a problem when there are two DataGrid's on one form, and when I switch focus from one grid to the other. To be more precise, when I'm editing a combo box column in one grid, and then click in the combo column of...
0
2021
by: Uchiha Jax | last post by:
When using a strongly typed dataset (generated from the Visual Studio IDE from an XSD file) and databinding I get a really odd error when binding to both a combox and a datetimepicker. I bind like the following: //// tDs is the strongly typed dataset, //// tDs.TheTask returns a strongly typed row from one of the tables. /// GetBindingTaskTypes() returns the types I want to use as a datasource in an arraylist.
0
1323
by: Brian Campbell | last post by:
I have some code that may be of some help to us newbies. It is for when you have a form with say two radio buttons, each activating/focusing its respective combo box and making its initial value null. Note the "fra" indicating all is within a frame. Note also in radio button properties they have a value that sets the case numbers below. Select Case Me.fraThisFrame.Value Case 1 With Me.cboFirstOne .Enabled = True
1
1021
by: Dustin Davis | last post by:
I have an XmlDataDocument. How do I go about converting this to something I can use as a datasource for a combobox?
5
1649
by: Pieter | last post by:
Hi, How can I convert KeyCode's to the real character? For instance: the row of keys on a keyboard under the F-keys return as Keycode the Keys.Oem1, Keys.Oem2 etc... Depending on the keyboard layout it is another character (and also depening on the fact if you have used Shift or Alt Gr). But my problem is: I would like to knwo the exact character the user sees on the screen.
3
7538
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going on. It's a simple program that loads a control onto a form and binds "Foo" against a combobox ("SelectedItem") for it's "Bar" property and a datetimepicker ("Value") for it's "DateTime" property. The DateTimePicker.Visible value is set to...
1
5216
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hello I've created a .NET 2.0 form and added 6 text boxes, 1 combo box and 2 button controls. The combo box has a DropDownStyle of DropDown, so the user can still type in the combo box. The combo box has the follows values in it's drop down list: "Dear Sir,"
0
1148
by: jereviscious | last post by:
Hi all I've added a combobox to the datagrid control using the following method dataGridTextBoxColumn7.TextBox.Controls.Add(comboControl); The problem is that when I tab to the Column that contains the combobox, the focus is on the underlying textbox in the datagrid.
0
9843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11272
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10863
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10971
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
8039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7201
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4720
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3317
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.