Click here to Skip to main content
15,905,963 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Designing Crystal Report at VB runtime ? Pin
Levi Rosol7-Jan-05 22:29
Levi Rosol7-Jan-05 22:29 
GeneralTo create a dynamic link(dll) with VS 2003 Pin
eduDirect7-Jan-05 11:19
eduDirect7-Jan-05 11:19 
GeneralSecurity Exception Problem !! Pin
Anonymous6-Jan-05 18:05
Anonymous6-Jan-05 18:05 
GeneralChanging the Image on an ImageButton in another Frame Pin
larkpics6-Jan-05 11:27
larkpics6-Jan-05 11:27 
GeneralRe: Changing the Image on an ImageButton in another Frame Pin
Dave Kreskowiak7-Jan-05 2:52
mveDave Kreskowiak7-Jan-05 2:52 
GeneralRe: Changing the Image on an ImageButton in another Frame Pin
larkpics7-Jan-05 3:03
larkpics7-Jan-05 3:03 
GeneralAdding EditItemTemplates to dynamic datagrid and changing the row to edit mode on doubleclick Pin
Member 16299646-Jan-05 5:52
Member 16299646-Jan-05 5:52 
GeneralMDI Child Forms (RESOLVED) Pin
fizzer6666-Jan-05 5:21
fizzer6666-Jan-05 5:21 
Hi all,

Here's my problem. I have an MDI but I don't want the user to be able to open more than one instance of a form at a time. I have written the following function. I think I am close but this still allows more than one instance open at one time or in other words allways returns False:

Private Function checkExistingForm(ByVal frm As Form) As Boolean
checkExistingForm = False
Dim frmArray() As Form
frmArray = Me.MdiChildren()
Dim frmArrayLength As Integer
frmArrayLength = frmArray.Length
Dim i As Integer
For i = 0 To frmArrayLength - 1
If frmArray(i) Is frm Then
Debug.WriteLine(frmArray(i))
checkExistingForm = True
Exit For
End If
Next

End Function

I call the above function in this code:

Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick

If e.Button Is Me.tbStock Then
Dim stockForm As New Stock
If Me.checkExistingForm(stockForm) = True Then
Exit Sub
End If
stockForm.MdiParent = Me

stockForm.Show()
End If
end sub

Any help would be greatly appreciated.


GeneralRe: MDI Child Forms Pin
Ritesh12346-Jan-05 21:43
Ritesh12346-Jan-05 21:43 
GeneralRe: MDI Child Forms (RESOLVED) Pin
fizzer6666-Jan-05 22:19
fizzer6666-Jan-05 22:19 
Generalline printing problem (Dos printer) Pin
Just Greeky Creek6-Jan-05 4:10
Just Greeky Creek6-Jan-05 4:10 
GeneralRe: line printing problem (Dos printer) Pin
Dave Kreskowiak7-Jan-05 2:47
mveDave Kreskowiak7-Jan-05 2:47 
GeneralRe: line printing problem (Dos printer) Pin
Dave Kreskowiak7-Jan-05 15:09
mveDave Kreskowiak7-Jan-05 15:09 
Generalsave and retrieve files Pin
len_ems5-Jan-05 18:59
len_ems5-Jan-05 18:59 
GeneralRe: save and retrieve files Pin
Ritesh12346-Jan-05 2:46
Ritesh12346-Jan-05 2:46 
GeneralRe: save and retrieve files Pin
len_ems6-Jan-05 16:03
len_ems6-Jan-05 16:03 
GeneralRe: save and retrieve files Pin
T Manjaly6-Jan-05 13:36
T Manjaly6-Jan-05 13:36 
GeneralRe: save and retrieve files Pin
len_ems6-Jan-05 16:12
len_ems6-Jan-05 16:12 
GeneralPrevent right click on the combobox or textbox Pin
Mekong River5-Jan-05 17:20
Mekong River5-Jan-05 17:20 
GeneralRe: Prevent right click on the combobox or textbox Pin
Tom John5-Jan-05 21:58
Tom John5-Jan-05 21:58 
GeneralRe: Prevent right click on the combobox or textbox Pin
T Manjaly6-Jan-05 13:38
T Manjaly6-Jan-05 13:38 
GeneralPassing parameters into Exe Pin
kobezt085-Jan-05 13:45
kobezt085-Jan-05 13:45 
GeneralRe: Passing parameters into Exe Pin
T Manjaly6-Jan-05 13:39
T Manjaly6-Jan-05 13:39 
GeneralRe: Passing parameters into Exe Pin
kobezt086-Jan-05 15:30
kobezt086-Jan-05 15:30 
GeneralCode for Project Pin
bdobruna5-Jan-05 8:20
bdobruna5-Jan-05 8:20 

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.