By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

Shortcuts on Buttons vb.net - strange behaviours

P: n/a
Hi everyone,

i was wondering if anyone else had observed this and if there is any
workaround

i have a screen (an mdi child form) with the buttons &Add, &Edit,
&Save and E&xit, the idea being that the user can use Alt+A, Alt+E etc
etc

when the screen loads, Add, Edit and Exit are enabled.

if the user selects Add or Edit then the Add/Edit/Exit buttons
disabled, and the Save button is enabled.

what i find is that the shortcut Alt+A is the only one that works, the
others just do not respond.

what is happening here?

this is anoying because i would like the users to use the keyboard as
much as possible, not the mouse.

please help

regards

Edwinah63
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hai Edwin,

I have worked on such cases, but never i have come accross such problems.....

check whehter u have assigned those hot keys for some other things also.

Nov 21 '05 #2

P: n/a
Experimentation may help. Try. disabling all the shortcuts except one of the
ones which currently does not work, test this with other keys and then
combinations until a pattern emerges

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Edwinah63" <ed*****@customercare.com.au> wrote in message
news:d7**************************@posting.google.c om...
Hi everyone,

i was wondering if anyone else had observed this and if there is any
workaround

i have a screen (an mdi child form) with the buttons &Add, &Edit,
&Save and E&xit, the idea being that the user can use Alt+A, Alt+E etc
etc

when the screen loads, Add, Edit and Exit are enabled.

if the user selects Add or Edit then the Add/Edit/Exit buttons
disabled, and the Save button is enabled.

what i find is that the shortcut Alt+A is the only one that works, the
others just do not respond.

what is happening here?

this is anoying because i would like the users to use the keyboard as
much as possible, not the mouse.

please help

regards

Edwinah63

Nov 21 '05 #3

P: n/a
* ed*****@customercare.com.au (Edwinah63) scripsit:
i have a screen (an mdi child form) with the buttons &Add, &Edit,
&Save and E&xit, the idea being that the user can use Alt+A, Alt+E etc
etc

when the screen loads, Add, Edit and Exit are enabled.

if the user selects Add or Edit then the Add/Edit/Exit buttons
disabled, and the Save button is enabled.

what i find is that the shortcut Alt+A is the only one that works, the
others just do not respond.

what is happening here?

this is anoying because i would like the users to use the keyboard as
much as possible, not the mouse.


Can you provide a test project somewhere and post a link to it?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4

P: n/a
Hi Herfried,

here is some cut and paste code for an mdi form and 2 forms with
identical buttons that reproduces the issue.

users can keep more than one form open at a time.

form2 is the mdi parent, form1 is the child

the buttons work fine if only one form is open, but dies if there are
more than one open.

look forward to your response
Edwinah63

*************mdi parent **************

Public Class Form2
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.Panel1 = New System.Windows.Forms.Panel
Me.Button1 = New System.Windows.Forms.Button
Me.Panel1.SuspendLayout()
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.Controls.Add(Me.Button1)
Me.Panel1.Location = New System.Drawing.Point(5, 382)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(148, 37)
Me.Panel1.TabIndex = 1
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(21, 7)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(105, 22)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form2
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(439, 451)
Me.Controls.Add(Me.Panel1)
Me.IsMdiContainer = True
Me.Name = "Form2"
Me.Text = "Form2"
Me.Panel1.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim f1 As New Form1
f1.MdiParent = Me
f1.Show()

Dim f2 As New Form1
f2.MdiParent = Me
f2.Show()

End Sub
End Class
****** now for the child form
Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents btnAdd As System.Windows.Forms.Button
Friend WithEvents btnEdit As System.Windows.Forms.Button
Friend WithEvents btnSave As System.Windows.Forms.Button
Friend WithEvents btnReset As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.btnAdd = New System.Windows.Forms.Button
Me.btnEdit = New System.Windows.Forms.Button
Me.btnSave = New System.Windows.Forms.Button
Me.btnReset = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'btnAdd
'
Me.btnAdd.Location = New System.Drawing.Point(17, 39)
Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(83, 23)
Me.btnAdd.TabIndex = 0
Me.btnAdd.Text = "&Add"
'
'btnEdit
'
Me.btnEdit.Location = New System.Drawing.Point(17, 73)
Me.btnEdit.Name = "btnEdit"
Me.btnEdit.Size = New System.Drawing.Size(80, 22)
Me.btnEdit.TabIndex = 1
Me.btnEdit.Text = "&Edit"
'
'btnSave
'
Me.btnSave.Location = New System.Drawing.Point(18, 114)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(78, 21)
Me.btnSave.TabIndex = 2
Me.btnSave.Text = "&Save"
'
'btnReset
'
Me.btnReset.Location = New System.Drawing.Point(18, 150)
Me.btnReset.Name = "btnReset"
Me.btnReset.Size = New System.Drawing.Size(80, 22)
Me.btnReset.TabIndex = 3
Me.btnReset.Text = "Rese&t"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(142, 93)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(138, 20)
Me.TextBox1.TabIndex = 4
Me.TextBox1.Text = ""
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.btnReset)
Me.Controls.Add(Me.btnSave)
Me.Controls.Add(Me.btnEdit)
Me.Controls.Add(Me.btnAdd)
Me.Name = "Form1"
Me.Text = "Hotkeys!!"
Me.ResumeLayout(False)

End Sub

#End Region
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
Me.TextBox1.Text = "Add"
Config("A")
End Sub

Private Sub btnEdit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnEdit.Click
Me.TextBox1.Text = "Edit"
Config("E")
End Sub
Private Sub btnSave_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSave.Click
Me.TextBox1.Text = "Save"
Config("R")
End Sub
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnReset.Click
'clear
Me.TextBox1.Text = ""
Config("R")
End Sub

Private Sub Config(ByVal x As String)

Select Case x
Case "A", "E"
btnAdd.Enabled = False
btnEdit.Enabled = False
btnSave.Enabled = True

Case "R"
btnAdd.Enabled = True
btnEdit.Enabled = True
btnSave.Enabled = False

End Select
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Config("R")
End Sub
End Class
Nov 21 '05 #5

P: n/a
Have i been forgotten? can someone please help me here.
Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.