Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (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 by PlausiblyDamp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...