Hello,
I want to create a class builder which will get the tables from the specified database and build my [className].vb file - at the push of a button!
For example:
To get this result in the clsExample.vb file that was created using the previous codeCode:Dim strBuilder As New StringBuilder strBuilder.Append("Public class clsExample" & vbCrLf) 'Create variables strBuilder.Append("Private _ID As String") strBuilder.Append(vbCrLf) 'Create properties strBuilder.Append("Public Property _ID() As Integer" & vbCrLf) strBuilder.Append("Get" & vbCrLf) strBuilder.Append("return _ID" & vbCrLf) strBuilder.Append("end Get" & vbCrLf) strBuilder.Append("Set(ByVal Value As Integer)" & vbCrLf) strBuilder.Append("_ID = Value" & vbCrLf) strBuilder.Append("End Set" & vbCrLf) strBuilder.Append("End Property " & vbCrLf) strBuilder.Append(vbCrLf) strBuilder.Append(vbCrLf & "End Class") Console.Write(strBuilder.ToString())
I'm not sure how to go about telling the program to create the [className].vb file and include my strBuilder as code in the file. Hope this makes sense...Code:Public Class clsExample Private _ID As String Public Property _ID() As Integer Get Return _ID End Get Set(ByVal Value As Integer) _ID = Value End Set End Property End Class




Reply With Quote
