prayank@cloudsentinels
Member
- Joined
- Dec 8, 2014
- Messages
- 5
- Programming Experience
- 1-3
I am using the below code to open a new form:
All the text fields in the form 'mdgeneral' show the output as expected when the form loads. But, when I click on a button inside the same form it does not do anything but it should ideally execute a code.
Below is the code for click event of the button which is not working in the new child form:
Am I missing something really important? Any help to fix this will be appreciated. Thanks.
VB.NET:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim NewMDIChild As New mdgeneral
'Set the Parent Form of the Child window.
NewMDIChild.MdiParent = Me
'Display the new form.
NewMDIChild.Show()
NewMDIChild.Height = 375
NewMDIChild.Width = 550
NewMDIChild.Location = New Point(150, 0)
NewMDIChild.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End Sub
All the text fields in the form 'mdgeneral' show the output as expected when the form loads. But, when I click on a button inside the same form it does not do anything but it should ideally execute a code.
Below is the code for click event of the button which is not working in the new child form:
VB.NET:
Private Sub Button1_Click(sender As Object, e As EventArgs)
sb.Append("$upn= get-mailbox -Identity " + mailboxpop.TextBox1.Text + " | select *userprincipalname* ")
sb.Append(vbNewLine) sb.Append("Set-Msoluser -FirstName " + TextBox6.Text + " | where {$_.UserPrincipalName -eq $upn.UserPrincipalName} ")
sb.AppendLine()
Dim strFilePath = (mydocpath & "\save.txt")
If System.IO.File.Exists(strFilePath) Then
System.IO.File.Delete(strFilePath)
End If
Using outfile As New StreamWriter(mydocpath & "\save.txt")
outfile.Write(sb.ToString())
End Using
strFilePath = (mydocpath & "\save.ps1")
If System.IO.File.Exists(strFilePath) Then
System.IO.File.Delete(strFilePath)
End If
System.IO.File.Move((mydocpath & "\save.txt"), (mydocpath & "\save.ps1"))
Try TextBox13.Text = Runcmd(mydocpath & "\save.ps1")
MsgBox("Done!")
Catch MsgBox("There was an error updating the information for this mailbox")
End Try
End Sub
Am I missing something really important? Any help to fix this will be appreciated. Thanks.
Last edited: