Click here to Skip to main content
15,919,358 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralListView to XML File Pin
Brad Fackrell29-Oct-03 1:38
Brad Fackrell29-Oct-03 1:38 
GeneralSSL in ASP.NET Pin
MySmallfish28-Oct-03 13:10
MySmallfish28-Oct-03 13:10 
GeneralRe: SSL in ASP.NET Pin
Heath Stewart30-Oct-03 3:35
protectorHeath Stewart30-Oct-03 3:35 
GeneralRe: SSL in ASP.NET Pin
MySmallfish30-Oct-03 7:03
MySmallfish30-Oct-03 7:03 
GeneralRe: SSL in ASP.NET Pin
Heath Stewart30-Oct-03 8:54
protectorHeath Stewart30-Oct-03 8:54 
QuestionCreating forms dynamically in VB??? Pin
NearyM28-Oct-03 10:12
NearyM28-Oct-03 10:12 
AnswerRe: Creating forms dynamically in VB??? Pin
Itanium28-Oct-03 18:27
Itanium28-Oct-03 18:27 
GeneralRe: Creating forms dynamically in VB??? Pin
Edbert P28-Oct-03 19:28
Edbert P28-Oct-03 19:28 
I suppose you could.
I am not very sure about this because although I've been thinking about it for my next project, I haven't tested it out yet.
Here's an example you might develop on (change it according to your need):

1. A function to create the dynamic form (it gets the parameters from database)
Public Function CreateForm(ByVal formName As String, ByVal location As Point, ByVal size As Size) As Form
Dim frmDyne As Form
frmDyne.Name = formName
frmDyne.Location = location
frmDyne.Size = size
CreateForm = frmDyne
End Function

2. A function to create the dynamic controls
Public Sub CreateControls(ByRef frmObject As Form)
Dim intX As Integer
Dim intTotalControls As Integer
Dim arrControl(5, 5) As String
'Read database and put into array (for example)
For intX = 1 To intTotalControls
If arrControl(0, 0) = "Textbox" Then
Dim txtBox As TextBox
txtBox.Name = arrControl(0, 1) 'Name of control
txtBox.Text = arrControl(0, 2) 'The text to display
txtBox.Top = arrControl(0, 3) 'Top
txtBox.Left = arrControl(0, 4) 'etc...
txtBox.Width = arrControl(0, 5)
txtBox.Height = arrControl(0, 6)
'and so on...
frmObject.Controls.Add(txtBox)
ElseIf arrControl(0, 0) = "ComboBox" Then
'Create a combobox here
End If
Next
End Sub

You can pass the form as a reference or call the function to create the controls when you create the form too, so they're all in one function or sub.
The point is you can create a dynamic form using this.

PS: Please tell me whether your project works or not, thanks!

Edbert P
GeneralRe: Creating forms dynamically in VB??? Pin
NearyM28-Oct-03 23:38
NearyM28-Oct-03 23:38 
GeneralSystem Events Pin
mikasa28-Oct-03 8:01
mikasa28-Oct-03 8:01 
GeneralRe: System Events Pin
Anonymous30-Oct-03 16:50
Anonymous30-Oct-03 16:50 
GeneralRe: System Events Pin
mikasa31-Oct-03 2:22
mikasa31-Oct-03 2:22 
GeneralSerialization Pin
dotnetminer27-Oct-03 21:03
dotnetminer27-Oct-03 21:03 
GeneralFloatign Toolba & Lines Flickering Pin
Itanium27-Oct-03 20:39
Itanium27-Oct-03 20:39 
GeneralDatagrid using VB.NET (web vs. windows) Pin
holdesb27-Oct-03 5:12
holdesb27-Oct-03 5:12 
GeneralMobile Web Calendar Control Pin
mathenjie27-Oct-03 2:28
mathenjie27-Oct-03 2:28 
GeneralWindows Shell API Pin
Curtis Adams26-Oct-03 7:29
Curtis Adams26-Oct-03 7:29 
QuestionHi,How to design a IIS Server? Pin
kinglate25-Oct-03 0:10
kinglate25-Oct-03 0:10 
AnswerRe: Hi,How to design a IIS Server? Pin
kinglate6-Nov-03 20:45
kinglate6-Nov-03 20:45 
GeneralNumericUpDown Control Question Pin
bnjneer24-Oct-03 6:56
bnjneer24-Oct-03 6:56 
GeneralRe: NumericUpDown Control Question Pin
Anonymous24-Oct-03 8:14
Anonymous24-Oct-03 8:14 
GeneralRe: NumericUpDown Control Question Pin
bnjneer24-Oct-03 8:35
bnjneer24-Oct-03 8:35 
GeneralAS400 Pin
Anonymous24-Oct-03 6:30
Anonymous24-Oct-03 6:30 
GeneralRe: AS400 Pin
Daniel Turini24-Oct-03 6:44
Daniel Turini24-Oct-03 6:44 
GeneralServer Explorer Error Pin
nevhile.net24-Oct-03 5:38
nevhile.net24-Oct-03 5:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.