th line of codeI have a DataGridView constructed of selected data from my database. Because of size constraints I have truncated 2 of the columns. When I click on one of the cells in the columns a textbox opens and is supposed to display the complete text in that field. When I do click on the cell the textbox opens, but the text is displayed across the top of the box and nothing in the body. If I press enter or the spacebar the text then appears in the body of the box.
How can I have the text appear in the box when it opens?
I have attached the cell-click subroutine and the textbox routine.
I have also tried the ToolTip tool and it works, but there are two problems. I would like to be able to control the window appearance similar to the CellClick code
(the window size, and color, and the font type and size) and have it stay active until released with a close button.
(Basic code attached)
What I have tried:
CellClick Code
Private Sub grdViewMovies_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles grdViewMovies.CellClick
Dim value As Object = grdViewMovies.Rows(e.RowIndex).Cells(e.ColumnIndex).Value
Dim colNumb As String = grdViewMovies.CurrentCell.ColumnIndex.ToString
If colNumb = 1 or colNumb = 2 Then
If IsDBNull(value) Then
MessageBox.Show("NO DATA IN THIS CELL", " NOTHING HERE", MessageBoxButtons.OK, MessageBoxIcon.Information)
ElseIf colNumb = "0" Then
Form1.again = False
Exit Sub
Else
displayText = CType(value, String)
Using sayitForm As New INFORMATION
sayitForm.Text = displayText
sayitForm.ShowDialog(Me)
End Using
End If
End If
End Sub
Private Sub closeBtn_Click(sender As Object, e As EventArgs) Handles closeBtn.Click
End Sub
End Class
Public Class INFORMATION
Private Sub txtSayit_TextChanged(sender As Object, e As EventArgs) Handles txtSayit.TextChanged
txtSayit.Text = SQLForm.displayText
End Sub
End Class
ToolTip Code
Private Sub grdViewMovies_CellMouseEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdViewMovies.CellMouseEnter
Dim myRow As Integer = e.RowIndex
Dim myCol As Integer = e.ColumnIndex
If myCol = 1 Or myCol = 2 And myRow > 0 Then
Me.grdViewMovies.Rows(myRow).Cells(myCol).ToolTipText = Me.grdViewMovies.Rows(myRow).Cells(myCol).Value
End If
End Sub