Properties Vb6 to vb.net

Posted by: juan.ome on 8 April 2019, 2:57 am EST

    • Post Options:
    • Link

    Posted 8 April 2019, 2:57 am EST

    We are migrating the tdbGrid controls from vb6 to vb.net, but we have not found equivalences for these properties: InsertMode and ConvertEmptyCell; And the MarqueeUnique property has a different behavior. Can you help us to understand to make a good mapping of this properties? thanks in advance…

  • Posted 9 April 2019, 10:41 pm EST

    Hello,

    1 : For the InsertMode property we need to take the cell editor as TextBox and handle the keypress event to use overstrike mode. Code snippet is given below :

    Private Sub C1TrueDBGrid1_ColEdit(sender As Object, e As C1.Win.C1TrueDBGrid.ColEventArgs) Handles C1TrueDBGrid1.ColEdit
    
    Dim Box As TextBox = TryCast(C1TrueDBGrid1.Editor, TextBox)
            If Box IsNot Nothing Then
                RemoveHandler Box.KeyPress, AddressOf Box_KeyPress
                AddHandler Box.KeyPress, AddressOf Box_KeyPress
            End If
        End Sub
    
     Private Sub Box_KeyPress(sender As Object, e As KeyPressEventArgs)
            Dim Box As TextBox = (TryCast(sender, TextBox))
            If Box.SelectionStart < Box.TextLength AndAlso Not Char.IsControl(e.KeyChar)           Then
                Dim SaveSelectionStart As Integer = Box.SelectionStart
                Dim sb As StringBuilder = New StringBuilder(Box.Text)
                sb(Box.SelectionStart) = e.KeyChar
                Box.Text = sb.ToString()
                Box.SelectionStart = SaveSelectionStart + 1
                e.Handled = True
            End If
     End Sub
    

    2 : For the ConvertEmptyCell property visit the sample in the location :

    C:\Users\UserName\Documents\ComponentOne Samples\WinForms\C1TrueDBGrid\VB

    3: Sorry but there is no such MarqueeUnique property available in TrueDbGrid for winforms.

    I am attaching a sample regarding the first point please go through it for better understanding.

    Thanks.

    TrueDbProperties.zip

  • Posted 9 April 2019, 10:41 pm EST

    Hello,

    1 : For the InsertMode property we need to take the cell editor as TextBox and handle the keypress event to use overstrike mode. Code snippet is given below :

    Private Sub C1TrueDBGrid1_ColEdit(sender As Object, e As C1.Win.C1TrueDBGrid.ColEventArgs) Handles C1TrueDBGrid1.ColEdit
    
    Dim Box As TextBox = TryCast(C1TrueDBGrid1.Editor, TextBox)
            If Box IsNot Nothing Then
                RemoveHandler Box.KeyPress, AddressOf Box_KeyPress
                AddHandler Box.KeyPress, AddressOf Box_KeyPress
            End If
        End Sub
    
     Private Sub Box_KeyPress(sender As Object, e As KeyPressEventArgs)
            Dim Box As TextBox = (TryCast(sender, TextBox))
            If Box.SelectionStart < Box.TextLength AndAlso Not Char.IsControl(e.KeyChar)           Then
                Dim SaveSelectionStart As Integer = Box.SelectionStart
                Dim sb As StringBuilder = New StringBuilder(Box.Text)
                sb(Box.SelectionStart) = e.KeyChar
                Box.Text = sb.ToString()
                Box.SelectionStart = SaveSelectionStart + 1
                e.Handled = True
            End If
     End Sub
    

    2 : For the ConvertEmptyCell property visit the sample in the location :

    C:\Users\UserName\Documents\ComponentOne Samples\WinForms\C1TrueDBGrid\VB

    3: Sorry but there is no such MarqueeUnique property available in TrueDbGrid for winforms.

    I am attaching a sample regarding the first point please go through it for better understanding.

    Thanks.

    TrueDbProperties.zip

  • Posted 12 April 2019, 1:08 am EST

    Thanks Mohitg,

    A question, it means that this properties has not design equivalences? we must to implement code?

    Thanks in advance.

    Claudia

  • Posted 22 April 2019, 8:49 pm EST

    Hello,

    Sorry for the delay!

    Every property has its own equivalence. As both the controls are from the different platform so there must be some difference in the property and method listing because they are designed separately as per the need.

    Although I have asked developers if they could add these properties in the upcoming builds(375954).

    Meanwhile, you can use the above-given code, if I get any update I’ll let you know.

    Thanks.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels