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

Visual Basic

 
GeneralRe: Control Like the Ones Used in the Windows Task Manager Pin
Christian Graus20-Jul-07 19:24
protectorChristian Graus20-Jul-07 19:24 
QuestionSystem.IO.FileNotFoundException: Could not load file or assembly 'ADODB, Version=7.0.3300.0, error in vb.net [modified] Pin
babusat20-Jul-07 17:49
babusat20-Jul-07 17:49 
AnswerRe: System.IO.FileNotFoundException: Could not load file or assembly 'ADODB, Version=7.0.3300.0, error in vb.net Pin
Luc Pattyn20-Jul-07 18:26
sitebuilderLuc Pattyn20-Jul-07 18:26 
Question"Value of type 'Double' cannot be converted ... Pin
schmidtjts20-Jul-07 13:51
schmidtjts20-Jul-07 13:51 
AnswerRe: "Value of type 'Double' cannot be converted ... Pin
Luc Pattyn20-Jul-07 17:18
sitebuilderLuc Pattyn20-Jul-07 17:18 
AnswerRe: "Value of type 'Double' cannot be converted ... Pin
Dave Kreskowiak22-Jul-07 4:28
mveDave Kreskowiak22-Jul-07 4:28 
GeneralRe: "Value of type 'Double' cannot be converted ... Pin
Luc Pattyn22-Jul-07 5:27
sitebuilderLuc Pattyn22-Jul-07 5:27 
QuestionSocket taking too long to close... Pin
uneasyrider20-Jul-07 9:39
uneasyrider20-Jul-07 9:39 
OK I'm about to pull my hair out on this one. I've got a socket created that sends a network stream of data from a listview to an open port.

It works great!! I'm getting ACK's back from the server with no problem. I can even send multiple messages at a time. HOWEVER...

If I highlight one item and send it... then highlight another item immediately afterwards and send it... I get a connection refused.

If I send one item, wait about 7-8 seconds... then send another one... I'm fine.

Please review my code and tell me where I'm going wrong!! Thanks in advance!!

Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click

        Dim ListViewSelect As ListView.SelectedListViewItemCollection = Me.ListView1.SelectedItems
        Dim item As ListViewItem
        Dim selecteditem As String
        Dim selecteditemhex As String = Chr(11)
        Dim SelectedCount As String
        Dim tcpClient As New System.Net.Sockets.TcpClient


        Try
            tcpClient.Connect("10.1.1.94", 8444)
            'tcpClient.Connect("127.0.0.1", 8444)
        Catch ex As Exception
            MessageBox.Show(Err.Description)
        End Try
        SelectedCount = ListViewSelect.Count()

        Select Case SelectedCount
            Case 0
                MessageBox.Show("Please select 1 item", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Case Is > 0
                For Each item In ListViewSelect

                    selecteditem = selecteditemhex + LTrim(item.SubItems(4).Text)

                    Dim networkStream As NetworkStream = tcpClient.GetStream

                    If networkStream.CanWrite And networkStream.CanRead Then
                        Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(selecteditem)
                        networkStream.Write(sendBytes, 0, sendBytes.Length)
                        Dim bytes(tcpClient.ReceiveBufferSize) As Byte
                        networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
                        Dim returndata As String = Encoding.ASCII.GetString(bytes)
                        MessageBox.Show("Host returned: " + returndata)
                    Else
                        If Not networkStream.CanRead Then
                            MessageBox.Show("cannot write data to this stream")
                            tcpClient.Close()
                        Else
                            If Not networkStream.CanWrite Then
                                MessageBox.Show("cannot read data from this stream")
                                tcpClient.Close()

                            End If
                        End If
                    End If
                Next

        End Select
        btnSend.Text = "Sent"
        tcpClient.GetStream.Close()
        'tcpClient.Close()
    End Sub

AnswerRe: Socket taking too long to close... Pin
Luc Pattyn20-Jul-07 17:32
sitebuilderLuc Pattyn20-Jul-07 17:32 
Questionvb.net Pin
sgi.manish20-Jul-07 9:38
sgi.manish20-Jul-07 9:38 
AnswerRe: vb.net Pin
Dave Kreskowiak20-Jul-07 10:01
mveDave Kreskowiak20-Jul-07 10:01 
GeneralRe: vb.net Pin
leckey20-Jul-07 10:08
leckey20-Jul-07 10:08 
AnswerPlease read the forum guidelines Pin
leckey20-Jul-07 10:06
leckey20-Jul-07 10:06 
GeneralRe: Please read the forum guidelines Pin
Paul Conrad20-Jul-07 10:28
professionalPaul Conrad20-Jul-07 10:28 
GeneralRe: Please read the forum guidelines Pin
leckey20-Jul-07 10:42
leckey20-Jul-07 10:42 
GeneralRe: Please read the forum guidelines Pin
Paul Conrad20-Jul-07 10:46
professionalPaul Conrad20-Jul-07 10:46 
QuestionVisual Basic -Data access ,Data missing Pin
Rajesh Rajan Pankapattu20-Jul-07 9:09
Rajesh Rajan Pankapattu20-Jul-07 9:09 
AnswerRe: Visual Basic -Data access ,Data missing Pin
ciacia20-Jul-07 9:28
ciacia20-Jul-07 9:28 
AnswerRe: Visual Basic -Data access ,Data missing Pin
cutequencher21-Jul-07 6:43
cutequencher21-Jul-07 6:43 
QuestionVB .NET - is it really worth it? Pin
GuyThiebaut20-Jul-07 6:47
professionalGuyThiebaut20-Jul-07 6:47 
AnswerRe: VB .NET - is it really worth it? Pin
Dave Kreskowiak20-Jul-07 7:11
mveDave Kreskowiak20-Jul-07 7:11 
GeneralRe: VB .NET - is it really worth it? Pin
GuyThiebaut20-Jul-07 7:39
professionalGuyThiebaut20-Jul-07 7:39 
GeneralRe: VB .NET - is it really worth it? Pin
Paul Conrad20-Jul-07 8:26
professionalPaul Conrad20-Jul-07 8:26 
GeneralRe: VB .NET - is it really worth it? Pin
Kevin McFarlane20-Jul-07 9:13
Kevin McFarlane20-Jul-07 9:13 
AnswerRe: VB .NET - is it really worth it? Pin
Christian Graus20-Jul-07 19:27
protectorChristian Graus20-Jul-07 19:27 

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.