.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 20th, 2012, 01:00 PM
MRb1980 MRb1980 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2010
Posts: 84 MRb1980 User rank is Corporal (100 - 500 Reputation Level)MRb1980 User rank is Corporal (100 - 500 Reputation Level)MRb1980 User rank is Corporal (100 - 500 Reputation Level)MRb1980 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 12 m 16 sec
Reputation Power: 4
Condensing this code into a single function?

Hello there Guru's of .Net!

I've got this as a workaround, but I don't think as this is the correct way of doing this; all I am after is getting the "Enter" key to be recognised in a ComboBox, and this is the only way it will work - but even this method has been 'not to reliable'.

Here is the code:-

Code:
    'this is called first
    Private Sub ParentDescription_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ParentDescription.KeyDown
        If e.KeyCode = Keys.Enter Then
            AddAssy.Enabled = True
            e.Handled = True
            Exit Sub
        End If
    End Sub
    'this is a natural second
    Private Sub ParentDescription_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ParentDescription.KeyPress

        'Check that a keypress is actually enter, and if it is, it's a seperate course of action - set the 'AddSub' button the enabled, then exit :)
        'If e.KeyChar = Chr("13") Then
        If Asc(e.KeyChar) = Keys.Enter Then
            AddAssy.Enabled = True
            Exit Sub
        End If

        'make any aplha char UPPERCASE
        If Char.IsLower(e.KeyChar) Then
            'Convert to uppercase.
            ParentDescription.SelectedText = Char.ToUpper(e.KeyChar)
            e.Handled = True
        End If
        'as you were.
    End Sub


Any suggestions on how I could achieve this would be greatly appreciated.

Cheers,
MRb

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Condensing this code into a single function?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap