I'm new to Visual Basic and I am trying to set up a currency converter. I have converted a currency to UK Sterling on the first form and on the second form I want to have the same label with the same amount of UK Sterling as on the first form on the second form. Please help!

You cannot have the same label, but you can use the same variable. The value in this variable will be shown in label on form1 and in label of form2.

'form1:
Class Form1
	Private f2 As Form2
	Public Sub New()
		InitializeComponent()
	End Sub

	Private Sub GetData()
		Dim decValue As Decimal = 123.45
		'some decimal value
		Dim strValue As String = [String].Format("{0:C}", decValue)
		'changed to currency of current language (I have Euro here, you will have Pounds if in UK)
		'show currency in label1 (on form1):
		label1.Text = strValue

		'now open (if not yet opened) and show the same currency on form2:
		If f2 Is Nothing Then
			f2 = New Form2()
		End If
		f2.UpdatingLabel(strValue)
	End Sub
End Class

'form2:
Class Form2
	Public Sub New()
		InitializeComponent()
	End Sub

	Public Sub UpdatingLabel(str As String)
		label1.Text = str
		'show currency in label1 (on form2)
	End Sub
End Class

Hopw this helps..
bye

I'm new to Visual Basic and I am trying to set up a currency converter. I have converted a currency to UK Sterling on the first form and on the second form I want to have the same label with the same amount of UK Sterling as on the first form on the second form. Please help!

'Form1 code goes here

Label1.Text= 'Currency amount
form2.Label1.Text=Label1.Text 'This statement can be written in form2 load event as below
'Form2 load event

Label1.Text=form1.Label1.Text

Hope this helps u

Thanks that really helped, it is working now. Much appreciated

Thanks that really helped, it is working now. Much appreciated

Mark the thread as solved if it helped u....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.