Passing values to modal form2 not showing on form

  • Thread starter Thread starter MigrationUser 1
  • Start date Start date
M

MigrationUser 1

Guest
Hi Gurus of VB.Net

I'm using context menu Item Click to open a form in order to add a record in a different table to that of the data on the current form. I need to values on the calling form to be assigned to controls on the called form. My problem is the values appear to be assigned (message boxes all over the place) but not reflected/showing on the called form. This is the code I have on the calling form

Public Sub AddNewStudioToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AddNewStudioToolStripMenuItem.Click

Try
Dim f As New frmStudios
f.Tag = Me.Name

f.ShowDialog(Me)
f.BringToFront()
Finally
f.Dispose()
End Try
End Sub

This is the code on the called form load event (calledby is defined as private string

Try
calledby = If(Tag = Nothing, Nothing, Tag)
MessageBox.Show(calledby)
MessageBox.Show(My.Forms.frmProfessional.cboProvince.SelectedValue)
MessageBox.Show(My.Forms.frmProfessional.txtEmail.Text)

I then load a datatable as datasource for cboProvince after which is this code

If calledby = "frmProfessional" Then
MessageBox.Show(My.Forms.frmProfessional.cboProvince.SelectedValue)
MessageBox.Show(My.Forms.frmProfessional.txtEmail.Text)
cboProvince.SelectedValue = My.Forms.frmProfessional.cboProvince.SelectedValue
txtEmailAddr.Text = My.Forms.frmProfessional.txtEmail.Text
Else
cboProvince.SelectedIndex = -1
End If

MessageBox.Show(cboProvince.SelectedValue)
MessageBox.Show(txtEmailAddr.Text)

Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Can anyone advise me why this display is not happening as I expected it to? Your guidance much appreciated

Continue reading...
 
Back
Top