- Joined
- Jun 5, 2007
- Messages
- 2,147 (0.35/day)
- Location
- Metro Manila, Philippines
System Name | Zangief (Reborn) |
---|---|
Processor | AMD Ryzen R7 1700X @ 3.825ghz , 1.35v |
Motherboard | Gigabyte GA-AX370 Gaming K7 Rev 1.0 BIOS F51e |
Cooling | Noctua NH-D15 Push / Push Config | 2x ML120 | 2x Phanteks 120 mm |
Memory | 2x8GB G.Skill Trident Z @ 3200mhz cl 16 @ 1.45v |
Video Card(s) | Gigabyte Aorus GTX 1080 +100 core / +550 mem |
Storage | 250 GB Samsung Evo 850 / 1tb WD Black / 4tb WD Blue / 512GB Adata XPG Pro SX8200 |
Display(s) | Acer Predator XB271HU |Asus VX239H 23" AH-IPS Led |
Case | Phanteks Enthoo Pro M TG |
Audio Device(s) | On Board Realtek HD / Logitech G633/G933 Gaming Headset / Corsair H70 Pro Wireless |
Power Supply | Corsair HX750i |
Mouse | Logitech G903 and G602 Wireless Gaming | Logitech Proteus Core G502 |
Keyboard | Corsair K70 Cherry Red | Corsair K70 RGB MK.2 Cherry Browns | Akko 3908N TTC Flame Reds |
Software | Windows 11 Pro |
Code:
Sub Go()
Dim p As New Process
p.StartInfo.FileName = "ping.exe"
p.StartInfo.Arguments = "www.bbc.co.uk -t"
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.CreateNoWindow = True
AddHandler p.OutputDataReceived, AddressOf bleh
p.Start()
p.BeginOutputReadLine()
End Sub
Sub bleh(ByVal sender As Object, ByVal e As DataReceivedEventArgs)
UpdateTextBox(e.Data)
End Sub
Private Delegate Sub UpdateTextBoxDelegate(ByVal Text As String)
Private Sub UpdateTextBox(ByVal Tex As String)
If Me.InvokeRequired Then
Dim del As New UpdateTextBoxDelegate(AddressOf UpdateTextBox)
Dim args As Object() = {Tex}
Me.Invoke(del, args)
Else
Form1.tb.Text &= Tex & Environment.NewLine
End If
End Sub
This code works well when it's in the forms main code, but when I transfer it to a separate class file it doesn't work. Specifically this set of code The update/output.
Code:
Private Sub UpdateTextBox(ByVal Tex As String)
If Me.InvokeRequired Then
Dim del As New UpdateTextBoxDelegate(AddressOf UpdateTextBox)
Dim args As Object() = {Tex}
Me.Invoke(del, args)
Else
Form1.tb.Text &= Tex & Environment.NewLine
End If
End Sub
Now when I change it to Me into form1 it compiles ok but the displayed text from ping does not show. And if I used "Me" I get this errors:
Error 1 'InvokeRequired' is not a member of 'txtbox_click_pinger.Class1'.
Error 2 'Invoke' is not a member of 'txtbox_click_pinger.Class1'.