Hack Forums
[.NET] Form2 Textbox doesn't want to add Form1 text from textbox? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Form2 Textbox doesn't want to add Form1 text from textbox? (/showthread.php?tid=5346608)



Form2 Textbox doesn't want to add Form1 text from textbox? - Moon Rock - Jul 21, 2016

So I'm stumped on this one, I'm trying to get my form2 (Log) textbox to add form1's text from it's textbox. Form1's text should be equal from a string, it adds it just fine how I want it, however it doesn't want to add it to form2's textbox. I've added my Debug.Writelines and it goes through the code clean and it doesn't throw any exceptions. In other subs it can add text to form2's textbox just fine. I've even added another textbox to my form1 to see if maybe it can't pull the text from textbox1 but it can -.-

Here's a code of what I'm trying to do.
Code
Log.TextBox1.Text &= DateTime.Now & vbNewLine
                Try
                    CheckForIllegalCrossThreadCalls = False
                    PROCS = message(1)
                    Debug.WriteLine("PROCS Has Text!")
                    Debug.WriteLine("Multi-Thead Start")
                    Strt.Start()
                    Debug.WriteLine("Multi-Thread Started")
                    TextBox4.Text &= " Processes " & " " & DateTime.Now & vbNewLine
                    Debug.WriteLine("Process textbox added!")
                    TextBox4.Text &= TextBox2.Text & " " & DateTime.Now & vbNewLine
                    Debug.WriteLine("Debug added text from process textbox")
                    Log.TextBox1.Text &= TextBox4.Text & vbNewLine
                    Debug.WriteLine("Updated Log Textbox Finished!")
                Catch ex As Exception
                    Debug.WriteLine(ex)
                    Log.TextBox1.Text &= ex.ToString & " " & DateTime.Now & vbNewLine
                End Try

Huge thanks for your help guys 🙂


* - Zilog80 - Jul 21, 2016

What is Log?
And PROCS?
And message(1)?
And Strt?

CheckForIllegalCrossThreadCalls = false
Really? 😠

Are you dealing with logs, right? Use NuGet and try:
Code
Install-package log4net

No need to reinventing the wheel.


* - Moon Rock - Jul 22, 2016

(Jul 21, 2016 05:50 PM)Zilog80 Wrote:  What is Log?
And PROCS?
And message(1)?
And Strt?

CheckForIllegalCrossThreadCalls = false
Really? 😠

Are you dealing with logs, right? Use NuGet and try:
Code
Install-package log4net

No need to reinventing the wheel.

Log is the name of Form2
PROCS is a String
Message(1) is also a String
Strt is another Thread for Multi-Threading.
My problem is probably what I posted needs to be in it's own thread. I'll post back results later today.

Solved my problem with adding this to my code.
Code
If Me.InvokeRequired Then
            Me.Invoke(New MethodInvoker(AddressOf Splitter))
            Else