Translating C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthew

    #1

    Translating C#

    I'm having the same problem described in this thread:
    http://tinyurl.com/9n66u

    The issue was solved with this C# code:
    public class MyCombo : ComboBox
    {
    private const int WM_KEYUP = 0x101;

    protected override void WndProc(ref
    System.Windows. Forms.Message m)
    {
    if(m.Msg == WM_KEYUP)
    {
    return;
    }
    base.WndProc(re f m);
    }

    }

    I think I have translated it to VB.NET properly:
    Public Class MyCombo
    Inherits DataGridComboBo x
    Public Const WM_KEYUP As Integer = &H101
    Protected Overrides Sub WndProc(ByRef m As
    System.Windows. Forms.Message)
    If (m.Msg = WM_KEYUP) Then
    Return
    End If
    MyBase.WndProc( m)
    End Sub
    End Class

    However, I can't get it to work.

    Can somebody take a look at it for me?

    Thanks...

    Matthew

  • Herfried K. Wagner [MVP]

    #2
    Re: Translating C#

    "Matthew" <PRESENT321@gma il.com> schrieb:[color=blue]
    > I'm having the same problem described in this thread:
    > http://tinyurl.com/9n66u
    >
    > The issue was solved with this C# code:
    > public class MyCombo : ComboBox
    > {
    > private const int WM_KEYUP = 0x101;
    >
    > protected override void WndProc(ref
    > System.Windows. Forms.Message m)
    > {
    > if(m.Msg == WM_KEYUP)
    > {
    > return;
    > }
    > base.WndProc(re f m);
    > }
    >
    > }
    >
    > I think I have translated it to VB.NET properly:
    > Public Class MyCombo
    > Inherits DataGridComboBo x
    > Public Const WM_KEYUP As Integer = &H101
    > Protected Overrides Sub WndProc(ByRef m As
    > System.Windows. Forms.Message)
    > If (m.Msg = WM_KEYUP) Then
    > Return
    > End If
    > MyBase.WndProc( m)
    > End Sub
    > End Class[/color]

    The first class inherits from 'ComboBox' whereas the second class inherits
    from 'DataGridComboB ox'. What's 'DataGridComboB ox'?

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Matthew

      #3
      Re: Translating C#

      Oops!
      Thanks for the reply.

      DataGridComboBo x is a cell in a DataGrid that acts like a ComboBox.
      The problem is, when I tab over to it, it's like I hit tab twice. I go
      right by it!
      The arrow keys work fine.
      This code is supposed to trap that tab keystroke.

      I fixed that mistake you pointed out, but it still does not work.
      Any further ideas?

      Matthew

      Comment

      • Cor Ligthert [MVP]

        #4
        Re: Translating C#

        Matthew,

        I made some changes on that one, which is probably as well not original,
        there are lot of samples from comboboxes on the net.. I don't even know
        anymore what I changed. Maybe you can try it.



        There is as well the columnstyle on our website.

        I hope this helps,

        Cor


        Comment

        • Matthew

          #5
          Re: Translating C#

          Cor,

          Wow! That traps tabs!
          One last problem. When I comment out this line:
          cmbTxtCol.Colum nComboBox.DropD ownStyle = ComboBoxStyle.D ropDownList

          It doesn't work properly. I need a the DropDown style, not
          DropDownList. That way people can type in it kind of like a textbox.
          That code still has the tab problem with the DropDown style.

          Matthew

          Comment

          • Cor Ligthert [MVP]

            #6
            Re: Translating C#

            Matthew,

            It is already a while ago that I made/changed this. And in VB2005 the
            combobox is a part of the DataGridView, I hope you don't mind that I don't
            want to put no time anymore in this.

            Cor


            Comment

            • Matthew

              #7
              Re: Translating C#

              Cor,

              I totally understand, and appreciate your comments and suggestions!

              Matthew

              Comment

              Working...