jai Posted September 1, 2006 Posted September 1, 2006 (edited) hi, Wonder if anyone can point me in the right direction...(VB.net 2005) Im trying to send data from formB to FormA's sendstuff sub... but getting and error on -> sw.Write(sdata & vbCr) Object reference not set to an instance of an object. And something about using "New"??? "Use the New keyword to create the instance" Its probably something basic, but after days of searching im now blind as to what im looking for :s Any help is much appreciated :) Jai parts from FormA: Imports System.Net.Sockets Public Class FormA Public tcp As TcpClient Dim netstream As NetworkStream Dim sr As IO.StreamReader Dim sw As IO.StreamWriter Dim identdThread As Threading.Thread Public Sub x1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles x1.Click tcp = New TcpClient() tcp.Connect("irc.blahblah.com", 6667) netstream = tcp.GetStream sr = New IO.StreamReader(netstream, System.Text.Encoding.ASCII) sw = New IO.StreamWriter(netstream, System.Text.Encoding.ASCII) Timer1.Enabled = True sw.WriteLine("NICK " + nick.Text) sw.Flush() sw.WriteLine("USER . . . .") sw.Flush() Public Sub sendstuff(ByVal sdata As String) sw.Write(sdata & vbCr) sw.Flush() End Sub parts from FormB: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click FormA.sendstuff("PRIVMSG #test test") End Sub Edited September 1, 2006 by PlausiblyDamp Quote
*Experts* mutant Posted September 1, 2006 *Experts* Posted September 1, 2006 You should research interaction between forms, and the following tutorial will help you: http://www.xtremedotnettalk.com/showthread.php?t=83092 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.