Help for a (probably) really dumb problem in vb.net?

KarmaEcrivain94

New member
Feb 1, 2013
374
0
0
Hi everyone,
I have a big problem, and I need a solution. Pretty fast.
Basically I have a TextBlock on my MainPage, but it's contents have to transfer to Page1 as soon as the user navigates there. How the hell can I do that in vb.net please? I thought of getting it to pass via an argument in the URI, but I have no idea how I could recuperate it once I'm on Page1...
I've been looking for 40 minutes, and still can't find anything, so I've come here :/

P.S. I'm a big newbie in the dev world, so I wouldn't refuse a little code alongside your explanations :P
 
I found a way around this. Pretty dirty, really not Professional, but it works just fine :)
Here is what I did:

On MainPage.xaml.vb:
Private Sub status_Tap(sender As Object, e As Input.GestureEventArgs) Handles StatusClick.Tap
NavigationService.Navigate(New Uri("/Page1.xaml", UriKind.Relative))
Dim objWriter As New System.IO.StreamWriter("Log.txt")
objWriter.Write(GhostText.Text)
objWriter.Close()
End Sub

On page1.xaml.vb
Private Sub LayoutRoot_Loaded(sender As Object, e As RoutedEventArgs) Handles LayoutRoot.Loaded
Dim srRead As New System.IO.StreamReader("Log.txt")
Dim strFileText As String = ""
strFileText = srRead.ReadToEnd
srRead.Close()
TextBlock1.Text = strFileText
End Sub
 
A dirty approach would be to create some shared fields on the app.vb and stash state there and reference via the class
 

Members online

No members online now.

Forum statistics

Threads
339,542
Messages
2,262,568
Members
428,760
Latest member
Jamie1