title: Why won't the button hotkey show up with an underline in VB?
body: <p>I just started a self-paced course in Visual Basic using Visual Studio. One of my assigned problems is to create a form with two buttons. When the form loads, Button1 is enabled and Button2 is disabled. When you click on Button1, Button1 is disabled and Button2 is enabled. When you then click on Button2, Button2 is disabled and Button1 is enabled.</p>
  <p>I got that to work easily, so I decided to add an extra challenge to myself. The challenge is that I want to make the disabled button show the text &quot;Disabled&quot; and the enabled button show &quot;Enabled&quot; with the &quot;E&quot; underlined as the hotkey for the button. I set a string variable for the enabled button containing the string &quot;&amp;Enabled&quot; to enable the &quot;E&quot; as the hotkey. The &quot;E&quot; works as the hotkey, but it does not display with an underline.</p>
  <p>I have searched the web for a fix to this issue, but I've come up dry. I also tried resizing the buttons to see if the buttons were too small to display the underline. That did not work. I have scrutinized my code, but I really don't know the language well enough to understand why the &quot;E&quot; does not show up with an underline. I am submitting my code and asking for help. I want to understand why this doesn't work the way I expect it to work.</p>
  <p>This is the VB.Net code that I wrote for the form using Visual Studio 2019.</p>
  <pre><code>    Public Class frmEnabledProblem
      Dim blnButton1Enabled As Boolean = True
      Dim blnButton2Enabled As Boolean = False
      Dim strButton1Enabled As String = &quot;&amp;Enabled&quot;
      Dim strButton1Disabled As String = &quot;Disabled&quot;
      Dim strButton2Enabled As String = &quot;&amp;Enabled&quot;
      Dim strButton2Disabled As String = &quot;Disabled&quot;
      Private Sub frmEnabledProblem_Load(sender As Object, e As EventArgs) Handles MyBase.Load
          Me.KeyPreview = True
          btnButton2.Text = strButton2Disabled
          btnButton2.Enabled = False
          btnButton1.Text = strButton1Enabled
          btnButton1.Enabled = True
  
      End Sub
  
      Private Sub btnButton1_Click(sender As Object, e As EventArgs) Handles btnButton1.Click
          blnButton1Enabled = False
          blnButton2Enabled = True
          btnButton1.Enabled = blnButton1Enabled
          btnButton2.Enabled = blnButton2Enabled
          btnButton1.Text = strButton1Disabled
          btnButton2.Text = strButton2Enabled
      End Sub
  
      Private Sub btnButton2_Click(sender As Object, e As EventArgs) Handles btnButton2.Click
          blnButton1Enabled = True
          blnButton2Enabled = False
          btnButton1.Enabled = blnButton1Enabled
          btnButton2.Enabled = blnButton2Enabled
          btnButton1.Text = strButton1Enabled
          btnButton2.Text = strButton2Disabled
      End Sub
  End Class
  </code></pre>
  <p>Thanks for your help.</p>