An overview of what I've done:
I've taken the base System.Windows.Forms.TextBox and have modified it a little to help me out in creating forms that generate SQL statements. I use to create a large function that would check for changes in the TextBox compared to a string. Then it would take that changed string and concatenate it to a SQL statement. Now it's simple and easier to use. I added two text properties that hold the SQL statement that the text is associated with and the default text displayed. I also added an ID integer for and needs to compare the IDs of textboxes and a boolean to check if the text was modified from the default string.
I have not fully implemented the new textbox in my code, but I am working on it.
It may only be slightly modified, but it should cut down my code from 500+ lines of code down to less than +-30 if ran in a for-loop.
SQLTextBox.vb
Public Class ModifiedTextBox
Inherits System.Windows.Forms.TextBox
Private _strDefaultText As String
Private _strSqlText As String
Private _nID As Integer
Private _bModified As Boolean = False
Property ID()
Set(nID)
_nID = nID
End Set
Get
Return _nID
End Get
End Property
Property TextModified()
Set(bModified)
_bModified = bModified
End Set
Get
Return _bModified
End Get
End Property
Property SqlText()
Set(strSqlText)
_strSqlText = strSqlText
End Set
Get
Return _strSqlText
End Get
End Property
Property DefaultText()
Set(strDefaultText)
_strDefaultText = strDefaultText
Me.Text = _strDefaultText
End Set
Get
Return _strDefaultText
End Get
End Property
End Class
All you need to do is add the default string, sql text, and ID. After that, you can do the normal event stuff for user-friendly environment.