[vb.net]How to communicate between Usercontrols

  • Thread starter Thread starter Mattia Fanti
  • Start date Start date
M

Mattia Fanti

Guest
Hi, I'm using form1 which contains Usercontrol1 and form2 which contains usercontrol2.

In usercontrol1 a webbrowser is extracting a link and I'd like to pass this link to usercontrol2 becuase It will create a QR code with google api.


So, in usercontrol1 I am not using nothing else than just webbrowser extracting the link.

I tried to declare a public "link" but it doesn't work.

In usercontrol2 i have:

'in usercontrol2
Dim sitoGoogleQrCode As String = "http://chart.googleapis.com/chart?chs={WIDTH}x{HEIGHT}&cht=qr&chl={TESTO}"
sitoGoogleQrCode = sitoGoogleQrCode.Replace("{WIDTH}", PictureBox1.Width.ToString()).Replace("{HEIGHT}", PictureBox1.Height.ToString()).Replace("{TESTO}", WebUtility.UrlEncode(usercontrol1.link))
Dim client As WebClient = New WebClient()

Dim bytes As Byte() = client.DownloadData(sitoGoogleQrCode)
client.Dispose()
Dim memStream As MemoryStream = New MemoryStream(bytes)
Dim bmpQrCode As Bitmap = New Bitmap(memStream)
PictureBox1.Image = bmpQrCode


There is a way to use that Usercontrol1 link variable in this code in usercontrol2?

Thanks

WebUtility.UrlEncode(usercontrol1.link))
Dim client As WebClient = New WebClient()

Continue reading...
 

Similar threads

Back
Top