Original Post
🔒 Locked
visual basic question
Advertisement
Quote:
Original post by Anonymous Poster
I believe you can still compile vb6 code in vb.NET. I also believe that .NET is much more than "just a couple of web site add-ons"
Yes, .NET is a whole new iteration of the compiler. The language has changed slightly, and is now built on top of the .NET framework, which could be a good thing and a bad thing.
Quote:
Original post by Anonymous Poster
I believe you can still compile vb6 code in vb.NET. I also believe that .NET is much more than "just a couple of web site add-ons"
Ummm, no. You can not compile VB6 code in .NET straight forward.
Here's some VB.NET code to show you:
Public Class ComboPlus Inherits System.Windows.Forms.ComboBox Dim doIt As Boolean = False Dim mAutoFill As Boolean = True Dim mEnterByTab As Boolean = True Event NotFounded(ByVal PalabraNoEncontrada As String) Property EnterByTab() As Boolean Get Return mEnterByTab End Get Set(ByVal Value As Boolean) mEnterByTab = Value End Set End Property Property AutoFill() As Boolean Get Return mAutoFill End Get Set(ByVal Value As Boolean) mAutoFill = Value End Set End Property Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs) Dim Index As Integer If mAutoFill AndAlso (e.KeyCode = Keys.Enter OrElse e.KeyCode = Keys.Back OrElse e.KeyCode = Keys.Delete) Then doIt = False Else doIt = True End If If e.KeyCode = Keys.Enter Then If Me.FindString(Me.Text) = -1 Then RaiseEvent NotFounded(Me.Text) ElseIf mEnterByTab Then Me.Select(0, 0) e.Handled = True SendKeys.Send("{TAB}") End If Else e.Handled = False MyBase.OnKeyDown(e) End If End Sub Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs) Dim Starts, Index As Integer If mAutoFill AndAlso doIt Then Index = Me.FindString(Me.Text) If Index >= 0 Then Starts = Me.Text.Length doIt = False If Me.DisplayMember = "" Then Me.Text = Me.Items.Item(Index).ToString Me.Select(Starts, Me.Items.Item(Index).ToString.Length - Starts) Else Me.Text = Me.Items.Item(Index).item(Me.DisplayMember) Me.Select(Starts, Me.Items.Item(Index).item(Me.DisplayMember).Length - Starts) End If doIt = True End If End If MyBase.OnTextChanged(e) End Sub Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs) If e.KeyChar = ChrW(13) Then e.Handled = True Else MyBase.OnKeyPress(e) End If End SubEnd ClassTopic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement