Click here to Skip to main content
15,923,557 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: im stuck in CRUD - my codes don't work. Pin
Dave Kreskowiak27-Oct-08 15:50
mveDave Kreskowiak27-Oct-08 15:50 
QuestionI have a problem on how to access parallel ports using visual basic2005. [modified] Pin
xolisa27-Oct-08 12:32
xolisa27-Oct-08 12:32 
AnswerRe: I have a problem on how to access parallel ports using visual basic2005. Pin
Dave Kreskowiak27-Oct-08 15:49
mveDave Kreskowiak27-Oct-08 15:49 
QuestionI cannot permanently save my records to my database. add, edit delete Pin
jac10001111010127-Oct-08 10:02
jac10001111010127-Oct-08 10:02 
AnswerRe: I cannot permanently save my records to my database. add, edit delete Pin
Dave Kreskowiak27-Oct-08 11:11
mveDave Kreskowiak27-Oct-08 11:11 
GeneralRe: I cannot permanently save my records to my database. add, edit delete Pin
jac10001111010127-Oct-08 12:16
jac10001111010127-Oct-08 12:16 
GeneralRe: I cannot permanently save my records to my database. add, edit delete Pin
Dave Kreskowiak27-Oct-08 15:33
mveDave Kreskowiak27-Oct-08 15:33 
QuestionProblem with .Net's NamedPipeServerStream and NamedPipeClientStream Pin
BubbaGeeNH27-Oct-08 7:26
BubbaGeeNH27-Oct-08 7:26 
I'm trying to use .Net 3.5's NamedPipeServerStream and NamedPipeClientStream and I'm having some problems. I'm able to send one commmunication between the client and server programs but when the client attempts to connect a second time it hangs. Any idea what I'm doing wrong?

SERVER CODE
-----------
Imports System
Imports System.IO
Imports System.IO.Pipes
Imports System.Threading
Imports System.Windows.Forms


Public Class SimServer
Private Delegate Sub InvokeDelegate(ByVal text As String)
Private newThread As New Thread(New ThreadStart(AddressOf PipeServer))
Private Sub PipeServer()
' Read the request from the client. Once the client has
' written to the pipe, its security token will be available.
Dim pipeServer As New NamedPipeServerStream("CognexPipe", PipeDirection.InOut, 10)
Dim sr As New StreamReader(pipeServer)
Dim sw As New StreamWriter(pipeServer)
Dim line As String
Dim retline As String
While (1)
pipeServer.WaitForConnection()
sw.AutoFlush = True
While (pipeServer.IsConnected)
If (sr.Peek > 0) Then
line = sr.ReadLine()
Me.BeginInvoke(New InvokeDelegate(AddressOf TextHandler), line)
retline = "Received: " + line
sw.WriteLine(retline)
End If
End While
End While
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
newThread.Start()
End Sub
Private Sub Form3_Close(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.FormClosing
newThread.Abort()
End Sub

Public Sub TextHandler(ByVal text As String)
ReceivedBox.Text = text
ReceivedBox.Update()
End Sub

End Class

CLIENT CODE
-----------
Imports System
Imports System.IO
Imports System.IO.Pipes
Imports System.Threading

Public Class SimClient

Private Sub SendButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendButton.Click
Dim pipeClient As New NamedPipeClientStream(".", "CognexPipe", PipeDirection.InOut)
Dim sr As New StreamReader(pipeClient)
Dim sw As New StreamWriter(pipeClient)
Dim line As String
Dim retline As String
If Not pipeClient.IsConnected Then
pipeClient.Connect()
End If
If pipeClient.IsConnected Then
sw.AutoFlush = True
line = CommandBox.Text
sw.WriteLine(line)
While sr.Peek = 0
End While
retline = sr.ReadLine()
ResponseBox.Text = retline
ResponseBox.Update()
sw.Close()
sr.Close()
End If
End Sub

End Class


Thanks for any help you all can give me.

George
AnswerRe: Problem with .Net's NamedPipeServerStream and NamedPipeClientStream Pin
Gideon Engelberth27-Oct-08 14:38
Gideon Engelberth27-Oct-08 14:38 
AnswerRe: Problem with .Net's NamedPipeServerStream and NamedPipeClientStream Pin
pointeman119-Aug-10 7:04
pointeman119-Aug-10 7:04 
Questionhow to use a variable value to call a class Pin
Turquoise7427-Oct-08 5:00
Turquoise7427-Oct-08 5:00 
AnswerRe: how to use a variable value to call a class Pin
Guffa27-Oct-08 7:34
Guffa27-Oct-08 7:34 
GeneralRe: how to use a variable value to call a class Pin
Turquoise7427-Oct-08 12:07
Turquoise7427-Oct-08 12:07 
GeneralRe: how to use a variable value to call a class Pin
Dave Kreskowiak27-Oct-08 15:35
mveDave Kreskowiak27-Oct-08 15:35 
GeneralRe: how to use a variable value to call a class Pin
Turquoise7427-Oct-08 16:36
Turquoise7427-Oct-08 16:36 
GeneralRe: how to use a variable value to call a class Pin
Dave Kreskowiak27-Oct-08 16:41
mveDave Kreskowiak27-Oct-08 16:41 
GeneralRe: how to use a variable value to call a class Pin
Turquoise7427-Oct-08 23:55
Turquoise7427-Oct-08 23:55 
QuestionVista glass efect in vb.net Pin
d3nika27-Oct-08 3:42
d3nika27-Oct-08 3:42 
AnswerRe: Vista glass efect in vb.net Pin
Dave Kreskowiak27-Oct-08 11:06
mveDave Kreskowiak27-Oct-08 11:06 
AnswerRe: Vista glass efect in vb.net Pin
Thomas Stockwell28-Oct-08 5:13
professionalThomas Stockwell28-Oct-08 5:13 
QuestionAdding new text file lines from another text file Pin
Member 425133526-Oct-08 20:26
Member 425133526-Oct-08 20:26 
AnswerRe: Adding new text file lines from another text file Pin
Ashfield26-Oct-08 22:34
Ashfield26-Oct-08 22:34 
QuestionHow can I show an image on Tooltip Pin
quyphidao@gmail.com26-Oct-08 20:17
quyphidao@gmail.com26-Oct-08 20:17 
AnswerRe: How can I show an image on Tooltip [modified] Pin
Shyam Bharath27-Oct-08 1:33
Shyam Bharath27-Oct-08 1:33 
GeneralRe: How can I show an image on Tooltip Pin
quyphidao@gmail.com27-Oct-08 14:42
quyphidao@gmail.com27-Oct-08 14:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.