Click here to Skip to main content
15,902,939 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: vb.net 2010 startup form for desktop application Pin
dcof4-Jun-15 11:29
dcof4-Jun-15 11:29 
GeneralRe: vb.net 2010 startup form for desktop application Pin
Sascha Lefèvre4-Jun-15 11:52
professionalSascha Lefèvre4-Jun-15 11:52 
QuestionVB.net 2010 desktop app select file from drop down list box Pin
dcof4-Jun-15 5:11
dcof4-Jun-15 5:11 
AnswerRe: VB.net 2010 desktop app select file from drop down list box Pin
Eddy Vluggen4-Jun-15 10:10
professionalEddy Vluggen4-Jun-15 10:10 
GeneralRe: VB.net 2010 desktop app select file from drop down list box Pin
dcof4-Jun-15 11:32
dcof4-Jun-15 11:32 
GeneralRe: VB.net 2010 desktop app select file from drop down list box Pin
Eddy Vluggen4-Jun-15 22:20
professionalEddy Vluggen4-Jun-15 22:20 
QuestionOpen a form when the name is known only on runtime Pin
satc3-Jun-15 9:35
satc3-Jun-15 9:35 
AnswerRe: Open a form when the name is known only on runtime Pin
Sascha Lefèvre3-Jun-15 10:26
professionalSascha Lefèvre3-Jun-15 10:26 
You can use reflection to search for the Type of the Form and then create an instance of it with Activator (Activator has bad performance compared to other methods but for Form-instantiation it won't matter):
VB
Dim formName As String = "Form1"
Dim formType As Type = Assembly.GetExecutingAssembly().GetTypes().[Single](Function(t) t.Name = formName)
Dim form As Form = DirectCast(Activator.CreateInstance(formType), Form)

In case the Form-class is defined in a different assembly than the assembly in which that code is executing you would have to replace GetExecutingAssembly():
VB
Dim formType As Type = Assembly.GetAssembly(someType).GetTypes().[Single](Function(t) t.Name = formName)

..where "someType" is any Type (static notation) that is defined in the same assembly as the Form.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

GeneralRe: Open a form when the name is known only on runtime Pin
satc3-Jun-15 16:29
satc3-Jun-15 16:29 
GeneralRe: Open a form when the name is known only on runtime Pin
Sascha Lefèvre3-Jun-15 22:00
professionalSascha Lefèvre3-Jun-15 22:00 
GeneralRe: Open a form when the name is known only on runtime Pin
satc4-Jun-15 9:57
satc4-Jun-15 9:57 
GeneralRe: Open a form when the name is known only on runtime Pin
Sascha Lefèvre4-Jun-15 10:41
professionalSascha Lefèvre4-Jun-15 10:41 
GeneralRe: Open a form when the name is known only on runtime Pin
satc4-Jun-15 18:26
satc4-Jun-15 18:26 
GeneralRe: Open a form when the name is known only on runtime Pin
Sascha Lefèvre4-Jun-15 18:42
professionalSascha Lefèvre4-Jun-15 18:42 
GeneralRe: Open a form when the name is known only on runtime Pin
satc4-Jun-15 19:44
satc4-Jun-15 19:44 
GeneralRe: Open a form when the name is known only on runtime Pin
Sascha Lefèvre4-Jun-15 19:56
professionalSascha Lefèvre4-Jun-15 19:56 
GeneralRe: Open a form when the name is known only on runtime Pin
satc4-Jun-15 20:10
satc4-Jun-15 20:10 
GeneralRe: Open a form when the name is known only on runtime Pin
Sascha Lefèvre4-Jun-15 21:17
professionalSascha Lefèvre4-Jun-15 21:17 
Questionvb.net 2010 desktop application add listbox Pin
dcof3-Jun-15 7:16
dcof3-Jun-15 7:16 
AnswerRe: vb.net 2010 desktop application add listbox Pin
Mycroft Holmes3-Jun-15 14:06
professionalMycroft Holmes3-Jun-15 14:06 
QuestionThe shortest way to do this ? Pin
satc2-Jun-15 13:35
satc2-Jun-15 13:35 
GeneralRe: The shortest way to do this ? Pin
PIEBALDconsult2-Jun-15 14:45
mvePIEBALDconsult2-Jun-15 14:45 
GeneralRe: The shortest way to do this ? Pin
Mycroft Holmes2-Jun-15 15:36
professionalMycroft Holmes2-Jun-15 15:36 
GeneralRe: The shortest way to do this ? Pin
PIEBALDconsult2-Jun-15 15:49
mvePIEBALDconsult2-Jun-15 15:49 
GeneralRe: The shortest way to do this ? Pin
satc2-Jun-15 15:58
satc2-Jun-15 15:58 

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.