Click here to Skip to main content
15,887,436 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Importing XLS file to DataTable Pin
DrukenProgrammer9-Sep-08 9:12
DrukenProgrammer9-Sep-08 9:12 
GeneralRe: Importing XLS file to DataTable Pin
Codemonkey859-Sep-08 9:23
Codemonkey859-Sep-08 9:23 
GeneralRe: Importing XLS file to DataTable Pin
DrukenProgrammer9-Sep-08 9:34
DrukenProgrammer9-Sep-08 9:34 
GeneralRe: Importing XLS file to DataTable Pin
Codemonkey859-Sep-08 9:43
Codemonkey859-Sep-08 9:43 
Questionform name as a property of a custom control Pin
Randana9-Sep-08 4:38
Randana9-Sep-08 4:38 
AnswerRe: form name as a property of a custom control Pin
Manas Bhardwaj9-Sep-08 4:40
professionalManas Bhardwaj9-Sep-08 4:40 
GeneralRe: form name as a property of a custom control Pin
Randana9-Sep-08 4:45
Randana9-Sep-08 4:45 
AnswerWhy just the form name? Pin
Gregory Gadow9-Sep-08 8:05
Gregory Gadow9-Sep-08 8:05 
It is a bit confusing that your post mentions just the form's name, but code you provided returns a form.

Keep in mind that a form is nothing more than a class with a visual interface. This means that anything you can do with a class, you can do with a form. Since ComboBoxes can hold any item, there is no reason they could not hold references to the forms you are using:
Dim F1 As New MyFormOne
Dim F2 As New MyFormTwo
Dim MyCntl As New MyControl

MyCntl.Items.Add(F1)
MyCntl.Items.Add(F2)
The text that is displayed in the ComboBox is derived from the object's ToString method. To have the box display the name, override this method in the form definition, like this:

Public Overrides Function ToString() As String
    Return Me.Name
End Function
Lastly, you can retrieve the form itself by looking at the ComboBox' SelectedItem property:

Dim SelectedForm As Form = Nothing
If MyCntl.SelectedItem IsNot Nothing Then
    SelectedForm = CType(MyCntl.SelectedItem, Form)
End If
From here, you can do whatever you want with SelectedForm. Hope this helps. Big Grin | :-D
QuestionCreate a Semi Background Transparant Form Pin
pdnet9-Sep-08 3:58
pdnet9-Sep-08 3:58 
AnswerRe: Create a Semi Background Transparant Form Pin
Manas Bhardwaj9-Sep-08 4:13
professionalManas Bhardwaj9-Sep-08 4:13 
GeneralRe: Create a Semi Background Transparant Form Pin
pdnet9-Sep-08 19:15
pdnet9-Sep-08 19:15 
QuestionChecking "previously checked" items in a checkbox Pin
C0ley9-Sep-08 3:32
C0ley9-Sep-08 3:32 
AnswerRe: Checking "previously checked" items in a checkbox Pin
Wendelius9-Sep-08 9:09
mentorWendelius9-Sep-08 9:09 
GeneralRe: Checking "previously checked" items in a checkbox Pin
C0ley9-Sep-08 9:46
C0ley9-Sep-08 9:46 
GeneralRe: Checking "previously checked" items in a checkbox Pin
Wendelius9-Sep-08 10:10
mentorWendelius9-Sep-08 10:10 
GeneralRe: Checking "previously checked" items in a checkbox Pin
C0ley10-Sep-08 0:05
C0ley10-Sep-08 0:05 
GeneralRe: Checking "previously checked" items in a checkbox Pin
C0ley10-Sep-08 0:14
C0ley10-Sep-08 0:14 
GeneralFIXED - Checking "previously checked" items in a checkbox Pin
C0ley10-Sep-08 2:20
C0ley10-Sep-08 2:20 
GeneralRe: FIXED - Checking "previously checked" items in a checkbox Pin
Wendelius10-Sep-08 8:26
mentorWendelius10-Sep-08 8:26 
QuestionReport with vb-net Pin
zagari9-Sep-08 1:04
zagari9-Sep-08 1:04 
AnswerRe: Report with vb-net Pin
Dave Kreskowiak9-Sep-08 6:55
mveDave Kreskowiak9-Sep-08 6:55 
Questionsystem.data.datarowview as string Pin
Ebube9-Sep-08 0:56
Ebube9-Sep-08 0:56 
AnswerRe: system.data.datarowview as string Pin
Manas Bhardwaj9-Sep-08 1:35
professionalManas Bhardwaj9-Sep-08 1:35 
GeneralRe: system.data.datarowview as string Pin
Ebube9-Sep-08 3:37
Ebube9-Sep-08 3:37 
GeneralRe: system.data.datarowview as string Pin
Manas Bhardwaj9-Sep-08 3:52
professionalManas Bhardwaj9-Sep-08 3:52 

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.