Click here to Skip to main content
15,900,258 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow do you Draw around (inside) a Group of adjacent Cells in a Column of a DataGridView Control Pin
Graham Irons6-Jun-09 22:17
Graham Irons6-Jun-09 22:17 
AnswerRe: How do you Draw around (inside) a Group of adjacent Cells in a Column of a DataGridView Control Pin
Christian Graus7-Jun-09 0:09
protectorChristian Graus7-Jun-09 0:09 
GeneralRe: How do you Draw around (inside) a Group of adjacent Cells in a Column of a DataGridView Control Pin
Graham Irons7-Jun-09 1:29
Graham Irons7-Jun-09 1:29 
GeneralRe: How do you Draw around (inside) a Group of adjacent Cells in a Column of a DataGridView Control Pin
Mycroft Holmes7-Jun-09 3:09
professionalMycroft Holmes7-Jun-09 3:09 
GeneralRe: How do you Draw around (inside) a Group of adjacent Cells in a Column of a DataGridView Control Pin
Graham Irons7-Jun-09 12:58
Graham Irons7-Jun-09 12:58 
GeneralRe: How do you Draw around (inside) a Group of adjacent Cells in a Column of a DataGridView Control Pin
Mycroft Holmes7-Jun-09 14:14
professionalMycroft Holmes7-Jun-09 14:14 
GeneralRe: How do you Draw around (inside) a Group of adjacent Cells in a Column of a DataGridView Control Pin
Graham Irons7-Jun-09 16:52
Graham Irons7-Jun-09 16:52 
QuestionIs it possible to create controls from a new thread in a multithreading windows form application Pin
Amer Rehman6-Jun-09 21:31
Amer Rehman6-Jun-09 21:31 
Hi
Here is the code that I'm working on.

Imports System.Threading
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

            tcpSend = New TcpSender
            Dim trSend As New Thread(AddressOf tcpSend.RetrieveData)
            trSend.Name = "Data Receiver"
            tcpSend.Command = "Send data"
            tcpSend.SysName = "Cabin1"
            tcpSend.Port = 100
            trSend.Start()
           
End Sub

Imports System.net
Imports System.Net.Sockets
Imports System.IO
Public Class TcpSender
      Public Event SystemReplied(ByVal data As String)
      Public Command, SysName As String, Port As Int16
      Public Sub RetrieveData()


            Try

                  Dim tcpCli As New TcpClient(SysName, Port)
                  Dim ns As NetworkStream = tcpCli.GetStream

                  Dim sw As New StreamWriter(ns)
                  Dim sr As New StreamReader(ns)

                  ' Send data to the client.
                  sw.WriteLine(Command)
                  sw.Flush()

                  ' Receive and display the response.
                  If Command = "Send data" Then

                        Dim strResult As String
                        'read the first line
                        strResult = sr.ReadLine & vbCrLf

                        If strResult <> "" Then
                              'reply has come from system so get the full data
                              For i As Byte = 0 To 2
                                    strResult += sr.ReadLine & vbCrLf
                              Next i

                              RaiseEvent SystemReplied(strResult)

                        End If

                  End If

                  sr.Close()
                  sw.Close()
                  ns.Close()
            Catch ex As Exception
                  'MsgBox(ex.Message)
            End Try

      End Sub

End Class
Private Sub SystemRepliedEventHandler(ByVal data As String) Handles tcpSend.SystemReplied

            'MsgBox(data)
            'create the controls to display data
            'this doesn't work
            Dim type As New TextBox
            type.Location = New Point(100, 100)
            type.Size = New Size(100, 100)
            type.Text = data
            Controls.Add(type)

           
End Sub

How to use control.invoke in the event handler. Any help would be appriciated much, as straighforwardly, I'm stuck here.

Thanks

reman

AnswerRe: Is it possible to create controls from a new thread in a multithreading windows form application Pin
Moreno Airoldi7-Jun-09 1:30
Moreno Airoldi7-Jun-09 1:30 
AnswerRe: Is it possible to create controls from a new thread in a multithreading windows form application Pin
Dave Kreskowiak7-Jun-09 7:18
mveDave Kreskowiak7-Jun-09 7:18 
Questionimage loop in vb.net Pin
bapu28896-Jun-09 11:56
bapu28896-Jun-09 11:56 
AnswerRe: image loop in vb.net Pin
Alan N6-Jun-09 12:23
Alan N6-Jun-09 12:23 
QuestionRe: image loop in vb.net Pin
bapu28896-Jun-09 23:21
bapu28896-Jun-09 23:21 
AnswerRe: image loop in vb.net Pin
Alan N7-Jun-09 0:34
Alan N7-Jun-09 0:34 
AnswerRe: image loop in vb.net Pin
0x3c06-Jun-09 23:36
0x3c06-Jun-09 23:36 
QuestionRe: image loop in vb.net Pin
bapu28897-Jun-09 0:20
bapu28897-Jun-09 0:20 
AnswerRe: image loop in vb.net Pin
riced7-Jun-09 0:51
riced7-Jun-09 0:51 
GeneralRe: image loop in vb.net Pin
Henry Minute7-Jun-09 1:05
Henry Minute7-Jun-09 1:05 
GeneralRe: image loop in vb.net Pin
riced7-Jun-09 1:14
riced7-Jun-09 1:14 
GeneralRe: image loop in vb.net Pin
Henry Minute7-Jun-09 1:22
Henry Minute7-Jun-09 1:22 
GeneralRe: image loop in vb.net Pin
riced7-Jun-09 1:30
riced7-Jun-09 1:30 
AnswerRe: image loop in vb.net Pin
bapu28897-Jun-09 2:29
bapu28897-Jun-09 2:29 
GeneralRe: image loop in vb.net Pin
Henry Minute7-Jun-09 4:45
Henry Minute7-Jun-09 4:45 
QuestionCommunicating over LAN in VB Net Pin
Jon11226-Jun-09 11:05
Jon11226-Jun-09 11:05 
AnswerRe: Communicating over LAN in VB Net Pin
Moreno Airoldi7-Jun-09 1:41
Moreno Airoldi7-Jun-09 1:41 

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.