Sir,

Please anybody help me while I am inserting the data through textbox of the selected item of the list box I want the when the user will input the data into textbox and then pressing the insert button the the selected item of list box (selected item only color change) color change white into blue or red.

kindly help me out.

Please

Sir,

Please anybody help me while I am inserting the data through textbox of the selected item of the list box I want the when the user will input the data into textbox and then pressing the insert button the the selected item of list box (selected item only color change) color change white into blue or red.

kindly help me out.

Private Sub lblani_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles lblani.DrawItem

        If txtlani.Text = "" Then
            'lblani.SelectedItem = colo

        Else
            ' Draw the background of the ListBox control for each item.
            e.DrawBackground()

            ' Define the default color of the brush as black.
            Dim myBrush As Brush = Brushes.Black

            ' Determine the color of the brush to draw each item based on   
            ' the index of the item to draw.
            Select Case e.Index

                Case 1
                    myBrush = Brushes.Orange

            End Select

            ' Draw the current item text based on the current 
            ' Font and the custom brush settings.
            e.Graphics.DrawString(lblani.Items(e.Index).ToString(), _
                e.Font, myBrush, e.Bounds, StringFormat.GenericDefault)

            ' If the ListBox has focus, draw a focus rectangle around  _ 
            ' the selected item.
            e.DrawFocusRectangle()
        End If



    End Sub

Private Sub lblani_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles lblani.DrawItem

        If txtlani.Text = "" Then
            'lblani.SelectedItem = colo

        Else
            ' Draw the background of the ListBox control for each item.
            e.DrawBackground()

            ' Define the default color of the brush as black.
            Dim myBrush As Brush = Brushes.Black

            ' Determine the color of the brush to draw each item based on   
            ' the index of the item to draw.
            Select Case e.Index

                Case 1
                    myBrush = Brushes.Orange

            End Select

            ' Draw the current item text based on the current 
            ' Font and the custom brush settings.
            e.Graphics.DrawString(lblani.Items(e.Index).ToString(), _
                e.Font, myBrush, e.Bounds, StringFormat.GenericDefault)

            ' If the ListBox has focus, draw a focus rectangle around  _ 
            ' the selected item.
            e.DrawFocusRectangle()
        End If



    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.