<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>CodeGuru Forums - Visual Basic .NET</title>
		<link>http://forums.codeguru.com/</link>
		<description>Microsoft Visual Basic .NET and related questions.</description>
		<language>en</language>
		<lastBuildDate>Thu, 23 May 2013 07:09:29 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://forums.codeguru.com/images/misc/rss.png</url>
			<title>CodeGuru Forums - Visual Basic .NET</title>
			<link>http://forums.codeguru.com/</link>
		</image>
		<item>
			<title>CRC calculation implementation HELL..</title>
			<link>http://forums.codeguru.com/showthread.php?537231-CRC-calculation-implementation-HELL..&amp;goto=newpost</link>
			<pubDate>Thu, 23 May 2013 07:03:09 GMT</pubDate>
			<description><![CDATA[So now i can comms with the device, however the CRC calculation does not work correctly... (I have 0 access to the Firmware) but the suppliers graciously gave us the CRC calculation in C++, which is as such
Code:
---------
static unsigned BitsSet (unsigned char ch)
{
    unsigned n;
    n = 0;
    while (ch)
    {
        n += (ch & 1);
        ch >>= 1;
    }
    return(n);
}

unsigned CRCof (const char *message, unsigned len)
{
    unsigned i;
    unsigned crc;
    unsigned char k;
    crc = 0;
    for (i=0; i<len; i++)
    {
        k = (unsigned char)(message[i]) ^ crc;
        crc = (crc / 256) ^ (k*128) ^ (k*64);
        if ((BitsSet(k) & 1) != 0)
            crc ^= 0xC001;
        }
    return(crc);
}
---------
Now my VB implementation 
Code:
---------
        Friend Function CRC(ByVal ParamArray Msg As Byte()) As Byte() 'CRC is 2 byte length
            Dim Result As UInt16 = 0
            Dim tmpB As Byte = 0
            Dim tmpint As Integer
            For tmpint = 0 To Msg.Length - 1
                tmpB = Msg(tmpint) Xor Result And &HFF
                Result = (Result \ 256) Xor (tmpB * 128) Xor (tmpB * 64)
                If ((BitsSet(tmpUint) And 1) <> 0) Then
                    Result = Result Xor &HC001
                End If
            Next
            CRC = ToByteArray(Result)
        End Function

        Friend Function BitsSet(ByVal data As UInt32) As Byte
            BitsSet = 0
            While data
                BitsSet += (data And 1)
                data >>= 1
            End While
        End Function
---------
Now no matter what i send to the device it always reply's with CRC error "GL!ER20A624" (the last 4 digits are the modules calculated CRC)... And if i send the module some Garbage i get a Invalid request "GL!ER2166E5"..

now using my code i'm trying to replicate the CRC, with 0 luck .... 

What have i converted incorrectly ???? I just cant see it.....]]></description>
			<content:encoded><![CDATA[<div>So now i can comms with the device, however the CRC calculation does not work correctly... (I have 0 access to the Firmware) but the suppliers graciously gave us the CRC calculation in C++, which is as such<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">static unsigned BitsSet (unsigned char ch)<br />
{<br />
&nbsp; &nbsp; unsigned n;<br />
&nbsp; &nbsp; n = 0;<br />
&nbsp; &nbsp; while (ch)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; n += (ch &amp; 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; ch &gt;&gt;= 1;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return(n);<br />
}<br />
<br />
unsigned CRCof (const char *message, unsigned len)<br />
{<br />
&nbsp; &nbsp; unsigned i;<br />
&nbsp; &nbsp; unsigned crc;<br />
&nbsp; &nbsp; unsigned char k;<br />
&nbsp; &nbsp; crc = 0;<br />
&nbsp; &nbsp; for (i=0; i&lt;len; i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; k = (unsigned char)(message[i]) ^ crc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; crc = (crc / 256) ^ (k*128) ^ (k*64);<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ((BitsSet(k) &amp; 1) != 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; crc ^= 0xC001;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; return(crc);<br />
}</code><hr />
</div> Now my VB implementation <div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; &nbsp; &nbsp; Friend Function CRC(ByVal ParamArray Msg As Byte()) As Byte() 'CRC is 2 byte length<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim Result As UInt16 = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim tmpB As Byte = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim tmpint As Integer<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For tmpint = 0 To Msg.Length - 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmpB = Msg(tmpint) Xor Result And &amp;HFF<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Result = (Result \ 256) Xor (tmpB * 128) Xor (tmpB * 64)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If ((BitsSet(tmpUint) And 1) &lt;&gt; 0) Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Result = Result Xor &amp;HC001<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Next<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CRC = ToByteArray(Result)<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Function<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Friend Function BitsSet(ByVal data As UInt32) As Byte<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BitsSet = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; While data<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BitsSet += (data And 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data &gt;&gt;= 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End While<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Function</code><hr />
</div> Now no matter what i send to the device it always reply's with CRC error &quot;GL!ER20A624&quot; (the last 4 digits are the modules calculated CRC)... And if i send the module some Garbage i get a Invalid request &quot;GL!ER2166E5&quot;..<br />
<br />
now using my code i'm trying to replicate the CRC, with 0 luck .... <br />
<br />
What have i converted incorrectly ???? I just cant see it.....</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>GremlinSA</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537231-CRC-calculation-implementation-HELL..</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] Com Ports in a Service...]]></title>
			<link>http://forums.codeguru.com/showthread.php?537211-RESOLVED-Com-Ports-in-a-Service...&amp;goto=newpost</link>
			<pubDate>Wed, 22 May 2013 10:48:06 GMT</pubDate>
			<description><![CDATA[Quick Background...

For a Specific system that we're developing we have certain USB Modules that connect to a Server, these modules use a pretty standard USB - Serial chip, so they look like Com ports to the OS.. we then send commands back and forth via serial coms..

USB - Serial is pretty standard stuff for us, and have several different products that work this way, and we coms with them very well, and can even handle the fact that USB can been unplugged and plugged back in, Anywhere..

Using a Normal Windows Forms Application, the Module coms works 100%.. I can detect the port, probe the device, and get a result...

However, once the identical code runs as a Installed service (Local System), using *sc create "Service Name" binpath= "FULL PATH TO EXECUTABLE" start= auto* , is where the 'FUN' starts.... BTW, the EXE is a Windows service project...

Because the Service is Formless, and has no MSGbox's, I write debug info to a log file.. (even in the Form app)

Bellow is the Form App log..
---Quote---
2013/05/22 12:17:10 PM , Scanning Comm ports 
2013/05/22 12:17:10 PM , Port Scanning: 1
2013/05/22 12:17:10 PM , Com Port: 5
2013/05/22 12:17:10 PM , opening port:5
2013/05/22 12:17:10 PM , Port OPEN
2013/05/22 12:17:10 PM , Checking Module on Com5
2013/05/22 12:17:10 PM , PORT Output:53;4D;3F;49;44;DA;AB;89;24;A;D;
2013/05/22 12:17:10 PM , Port Incomming
2013/05/22 12:17:10 PM , PORT Input:GL!ER2166E5
---End Quote---
 Ok yes the module sends back an Error report, (something not quite right in the CRC i'm sending it), however i get a reply from it...

Now with the service App I get the following...
---Quote---
2013/05/22 12:14:31 PM , Scanning Comm ports 
2013/05/22 12:14:31 PM , Port Scanning: 1
2013/05/22 12:14:31 PM , Com Port: 5
2013/05/22 12:14:31 PM , opening port:5
2013/05/22 12:14:31 PM , Port Error : System.IO.IOException: The port 'COM5' does not exist.
   at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
   at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
   at System.IO.Ports.SerialPort.Open()
   at Prism_Comms.Prism.ComObject.OPEN(String Port) in C:\Work\CF4Source\Prism_Comms\PrismComms.vb:line 113
2013/05/22 12:14:31 PM , Checking Module on Com5
2013/05/22 12:14:31 PM , PORT Output:53;4D;3F;49;44;DA;AB;89;24;A;D;
2013/05/22 12:14:31 PM , Port Error : System.NullReferenceException: Object reference not set to an instance of an object.
   at Prism_Comms.Prism.ComObject.SendModemData(Byte[] Input) in C:\Work\CF4Source\Prism_Comms\PrismComms.vb:line 247
---End Quote---
Now the Class project 'PrismComms' is the identicle file for both.. and essentially the code in there is called as such

Code:
---------
         Port = New Prism_Comms.Prism.PrismComms(Debuglog)
        If Port.SearchModules(Modules) Then
            If Modules.Count > 1 Then
                _Modonline = True
            End If
        End If
---------
And the related code in the class is 
Code:
---------
        Public Function SearchModules(ByRef Modules As List(Of ComVals.ModList)) As Boolean
            Dim AllPorts() As Byte
            ReDim AllPorts(0)
            Get_Port_List(AllPorts)
            If _Debug Then
                RaiseEvent DebugE("Port Scanning: " & AllPorts.Length)
            End If
            Locate_Module(AllPorts, Modules)
        End Function

        Private Sub Get_Port_List(ByRef Ports() As Byte)
            ' Get all available COM ports.
            Dim Tmp_L As Long
            ReDim Ports(0)
            For Each SPort As String In My.Computer.Ports.SerialPortNames
                Try
                    ReDim Preserve Ports(Tmp_L)
                    Ports(Tmp_L) = CByte(SPort.Substring(3))
                    Tmp_L += 1
                Catch ex As Exception
                    ReDim Preserve Ports(Tmp_L - 1)
                End Try
            Next

        End Sub

        Private Sub Locate_Module(ByVal Ports() As Byte, ByRef Modules As List(Of ComVals.ModList))
            Dim TmpStr As String
            Dim TmpMod As ComVals.ModList
            Modules = New List(Of ComVals.ModList)
            For Each Comm In Ports
                If _Debug Then
                    RaiseEvent DebugE("Com Port: " & Comm)
                End If
                ModComms = New ComObject(_Debug)
                ModComms.OPEN(Comm)
                If _Debug Then
                    RaiseEvent DebugE("Checking Module on Com" & Comm)
                End If
                If ModComms.CheckModem() Then
                    If _Debug Then
                        RaiseEvent DebugE("Reply from Module")
                    End If
                    TmpStr = ModComms.GetID()
                    TmpMod = New ComVals.ModList
                    TmpMod.Name = TmpStr
                    TmpMod.Port = Comm
                    TmpMod.ID = Comm
                    Modules.Add(TmpMod)
                End If
                ModComms.Close()
                ModComms = Nothing
            Next
        End Sub
---------
Now you might notice that i then have a wrapped the Actual serialport with ComObject.. this was intentially done for Multiple Modules to work simultaneously, as needed..  the important ComObject code is 
Code:
---------
        Public Const cmd_Get_Ident As String = "SM?ID"

        Public Sub OPEN(ByVal Port As String)
            RaiseEvent DebugE("opening port:" & Port)
            Try
                Comms = New System.IO.Ports.SerialPort
                Comms.Encoding = System.Text.ASCIIEncoding.Default
                Comms.Handshake = IO.Ports.Handshake.None
                Comms.BaudRate = 9600
                Comms.DataBits = 8
                Comms.Parity = IO.Ports.Parity.None
                Comms.StopBits = IO.Ports.StopBits.One
                Comms.PortName = "COM" & Port
                Comms.ReceivedBytesThreshold = 1
                Comms.Open()
                _Status = ComVals.StatusObj.Port_Open
                WDTimer = New System.Timers.Timer
                WDTimer.Enabled = False
                WDTimer.Interval = 500
                WDTimer.AutoReset = True
                WDTimer.Enabled = True
                RaiseEvent DebugE("Port OPEN")
            Catch ex As Exception
                Comms = Nothing
                _Status = ComVals.StatusObj.Port_Error
                RaiseEvent DebugE("Port Error : " & ex.ToString)
            End Try
        End Sub

        Public Sub New(ByVal Debug As Boolean)
            _Debug = Debug
            _Progress = ComVals.ProgressObj.Offline
            _Nulls = ""
            For TmpInt = 0 To 40
                _Nulls = _Nulls & Chr(0)
            Next
            _ReadData = ComVals.DataObj.No_data
            _Status = ComVals.StatusObj.Port_Close
        End Sub

        Public Function CheckModem() As Boolean
            _ConfigMode = True
            ReplyReceived = False
            _Status = ComVals.StatusObj.Port_Scan
            SendModemData(BuildOutput(cmd_Get_Ident))
            Threading.Thread.Sleep(100)
            If ReplyReceived Then
                Return True
            Else
                Return False
            End If
        End Function

        Public Function GetID() As String
            _ConfigMode = True
            ReplyReceived = False
            _Status = ComVals.StatusObj.Port_Open
            SendModemData(BuildOutput(cmd_Get_Ident))
            Threading.Thread.Sleep(100)
            If ReplyReceived Then
                Return _InBuffer
            Else
                Return "ER"
            End If
        End Function

        Private Function BuildOutput(ByVal Input As String) As Byte()
            Dim TmpCRC As Byte()
            Dim tmpint As Integer
            Dim Output As Byte()
            Output = ToByteArray(Input)
            TmpCRC = CRC(Output)
            tmpint = Output.Length
            ReDim Preserve Output(tmpint + 5)
            For loop1 As Integer = 0 To 3
                Output(tmpint + loop1) = TmpCRC(loop1)
            Next
            Output(tmpint + 4) = 10
            Output(tmpint + 5) = 13
            Return Output
        End Function


        Private Sub SendModemData(ByVal Input As Byte())
            Dim Strlen As String = ""
            Try
                If _Debug Then
                    For counter = 0 To Input.Length - 1
                        Strlen += Hex(Input(counter)) & ";"
                    Next
                    RaiseEvent DebugE("PORT Output:" & Strlen)
                End If
                Comms.Write(Input, 0, Input.Length)
                ' Pause and wait for reply.
                System.Threading.Thread.Sleep(_SleepTime)

                If _Debug Then
                    RaiseEvent DebugE("After " & _SleepTime & "ms :" & Comms.BytesToRead & " Bytes in buffer")
                End If

            Catch ex As Exception
                _Status = ComVals.StatusObj.Port_Error
                RaiseEvent DebugE("Port Error : " & ex.ToString)
            End Try
        End Sub

        Private Sub Comms_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles Comms.DataReceived
            If _Debug Then
                RaiseEvent DebugE("Port Incomming")
            End If
            _InBuffer = ""
            Dim Tmpcnt As Integer = 0
            Dim Strlen As String = ""
            Try
                Do
                    Do
                        _InBuffer = _InBuffer & Chr(Comms.ReadByte)
                    Loop Until Comms.BytesToRead = 0
                    ''''Pause and let the buffer fill up ...
                    System.Threading.Thread.Sleep(_BufferTime)
                Loop Until Comms.BytesToRead = 0
            Catch ex As Exception
                _Status = ComVals.StatusObj.Port_Error
                _Err = ex.ToString
            End Try
            'Lets start working with the data..
            If _Debug Then
                RaiseEvent DebugE("PORT Input:" & _InBuffer)
            End If

            Select Case _Status
                Case ComVals.StatusObj.Port_Scan
                    If _InBuffer.StartsWith("SM!ID") Then
                        ReplyReceived = True
                        Exit Sub
                    End If
            End Select

        End Sub
---------
What have i done wrong, that the service simply does not wana connect to the serial port ???? Must i use a different serial object... Been going nuts on this for the last week now.... Please help .....]]></description>
			<content:encoded><![CDATA[<div>Quick Background...<br />
<br />
For a Specific system that we're developing we have certain USB Modules that connect to a Server, these modules use a pretty standard USB - Serial chip, so they look like Com ports to the OS.. we then send commands back and forth via serial coms..<br />
<br />
USB - Serial is pretty standard stuff for us, and have several different products that work this way, and we coms with them very well, and can even handle the fact that USB can been unplugged and plugged back in, Anywhere..<br />
<br />
Using a Normal Windows Forms Application, the Module coms works 100%.. I can detect the port, probe the device, and get a result...<br />
<br />
However, once the identical code runs as a Installed service (Local System), using <b>sc create &quot;Service Name&quot; binpath= &quot;FULL PATH TO EXECUTABLE&quot; start= auto</b> , is where the 'FUN' starts.... BTW, the EXE is a Windows service project...<br />
<br />
Because the Service is Formless, and has no MSGbox's, I write debug info to a log file.. (even in the Form app)<br />
<br />
Bellow is the Form App log..<div class="bbcode_container">
	<div class="bbcode_description">Quote:</div>
	<div class="bbcode_quote printable">
		<hr />
		
			2013/05/22 12:17:10 PM , Scanning Comm ports <br />
2013/05/22 12:17:10 PM , Port Scanning: 1<br />
2013/05/22 12:17:10 PM , Com Port: 5<br />
2013/05/22 12:17:10 PM , opening port:5<br />
2013/05/22 12:17:10 PM , Port OPEN<br />
2013/05/22 12:17:10 PM , Checking Module on Com5<br />
2013/05/22 12:17:10 PM , PORT Output:53;4D;3F;49;44;DA;AB;89;24;A;D;<br />
2013/05/22 12:17:10 PM , Port Incomming<br />
2013/05/22 12:17:10 PM , PORT Input:GL!ER2166E5
			
		<hr />
	</div>
</div>  Ok yes the module sends back an Error report, (something not quite right in the CRC i'm sending it), however i get a reply from it...<br />
<br />
Now with the service App I get the following...<div class="bbcode_container">
	<div class="bbcode_description">Quote:</div>
	<div class="bbcode_quote printable">
		<hr />
		
			2013/05/22 12:14:31 PM , Scanning Comm ports <br />
2013/05/22 12:14:31 PM , Port Scanning: 1<br />
2013/05/22 12:14:31 PM , Com Port: 5<br />
2013/05/22 12:14:31 PM , opening port:5<br />
2013/05/22 12:14:31 PM , Port Error : System.IO.IOException: The port 'COM5' does not exist.<br />
   at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)<br />
   at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)<br />
   at System.IO.Ports.SerialPort.Open()<br />
   at Prism_Comms.Prism.ComObject.OPEN(String Port) in C:\Work\CF4Source\Prism_Comms\PrismComms.vb:line 113<br />
2013/05/22 12:14:31 PM , Checking Module on Com5<br />
2013/05/22 12:14:31 PM , PORT Output:53;4D;3F;49;44;DA;AB;89;24;A;D;<br />
2013/05/22 12:14:31 PM , Port Error : System.NullReferenceException: Object reference not set to an instance of an object.<br />
   at Prism_Comms.Prism.ComObject.SendModemData(Byte[] Input) in C:\Work\CF4Source\Prism_Comms\PrismComms.vb:line 247
			
		<hr />
	</div>
</div> Now the Class project 'PrismComms' is the identicle file for both.. and essentially the code in there is called as such<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; &nbsp; &nbsp;  Port = New Prism_Comms.Prism.PrismComms(Debuglog)<br />
&nbsp; &nbsp; &nbsp; &nbsp; If Port.SearchModules(Modules) Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Modules.Count &gt; 1 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Modonline = True<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; End If</code><hr />
</div> And the related code in the class is <div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; &nbsp; &nbsp; Public Function SearchModules(ByRef Modules As List(Of ComVals.ModList)) As Boolean<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim AllPorts() As Byte<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ReDim AllPorts(0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Get_Port_List(AllPorts)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If _Debug Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;Port Scanning: &quot; &amp; AllPorts.Length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Locate_Module(AllPorts, Modules)<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Function<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Private Sub Get_Port_List(ByRef Ports() As Byte)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' Get all available COM ports.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim Tmp_L As Long<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ReDim Ports(0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For Each SPort As String In My.Computer.Ports.SerialPortNames<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ReDim Preserve Ports(Tmp_L)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ports(Tmp_L) = CByte(SPort.Substring(3))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tmp_L += 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Catch ex As Exception<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ReDim Preserve Ports(Tmp_L - 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Next<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Sub<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Private Sub Locate_Module(ByVal Ports() As Byte, ByRef Modules As List(Of ComVals.ModList))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim TmpStr As String<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim TmpMod As ComVals.ModList<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Modules = New List(Of ComVals.ModList)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For Each Comm In Ports<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If _Debug Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;Com Port: &quot; &amp; Comm)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ModComms = New ComObject(_Debug)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ModComms.OPEN(Comm)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If _Debug Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;Checking Module on Com&quot; &amp; Comm)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If ModComms.CheckModem() Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If _Debug Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;Reply from Module&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TmpStr = ModComms.GetID()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TmpMod = New ComVals.ModList<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TmpMod.Name = TmpStr<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TmpMod.Port = Comm<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TmpMod.ID = Comm<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Modules.Add(TmpMod)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ModComms.Close()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ModComms = Nothing<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Next<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Sub</code><hr />
</div> Now you might notice that i then have a wrapped the Actual serialport with ComObject.. this was intentially done for Multiple Modules to work simultaneously, as needed..  the important ComObject code is <div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; &nbsp; &nbsp; Public Const cmd_Get_Ident As String = &quot;SM?ID&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Public Sub OPEN(ByVal Port As String)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;opening port:&quot; &amp; Port)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms = New System.IO.Ports.SerialPort<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms.Encoding = System.Text.ASCIIEncoding.Default<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms.Handshake = IO.Ports.Handshake.None<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms.BaudRate = 9600<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms.DataBits = 8<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms.Parity = IO.Ports.Parity.None<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms.StopBits = IO.Ports.StopBits.One<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms.PortName = &quot;COM&quot; &amp; Port<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms.ReceivedBytesThreshold = 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms.Open()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Status = ComVals.StatusObj.Port_Open<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WDTimer = New System.Timers.Timer<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WDTimer.Enabled = False<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WDTimer.Interval = 500<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WDTimer.AutoReset = True<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WDTimer.Enabled = True<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;Port OPEN&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Catch ex As Exception<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms = Nothing<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Status = ComVals.StatusObj.Port_Error<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;Port Error : &quot; &amp; ex.ToString)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Sub<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Public Sub New(ByVal Debug As Boolean)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Debug = Debug<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Progress = ComVals.ProgressObj.Offline<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Nulls = &quot;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For TmpInt = 0 To 40<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Nulls = _Nulls &amp; Chr(0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Next<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _ReadData = ComVals.DataObj.No_data<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Status = ComVals.StatusObj.Port_Close<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Sub<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Public Function CheckModem() As Boolean<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _ConfigMode = True<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ReplyReceived = False<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Status = ComVals.StatusObj.Port_Scan<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SendModemData(BuildOutput(cmd_Get_Ident))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Threading.Thread.Sleep(100)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If ReplyReceived Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return True<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return False<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Function<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Public Function GetID() As String<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _ConfigMode = True<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ReplyReceived = False<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Status = ComVals.StatusObj.Port_Open<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SendModemData(BuildOutput(cmd_Get_Ident))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Threading.Thread.Sleep(100)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If ReplyReceived Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return _InBuffer<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return &quot;ER&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Function<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Private Function BuildOutput(ByVal Input As String) As Byte()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim TmpCRC As Byte()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim tmpint As Integer<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim Output As Byte()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Output = ToByteArray(Input)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TmpCRC = CRC(Output)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmpint = Output.Length<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ReDim Preserve Output(tmpint + 5)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For loop1 As Integer = 0 To 3<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Output(tmpint + loop1) = TmpCRC(loop1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Next<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Output(tmpint + 4) = 10<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Output(tmpint + 5) = 13<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return Output<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Function<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Private Sub SendModemData(ByVal Input As Byte())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim Strlen As String = &quot;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If _Debug Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For counter = 0 To Input.Length - 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Strlen += Hex(Input(counter)) &amp; &quot;;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Next<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;PORT Output:&quot; &amp; Strlen)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comms.Write(Input, 0, Input.Length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' Pause and wait for reply.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.Threading.Thread.Sleep(_SleepTime)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If _Debug Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;After &quot; &amp; _SleepTime &amp; &quot;ms :&quot; &amp; Comms.BytesToRead &amp; &quot; Bytes in buffer&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Catch ex As Exception<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Status = ComVals.StatusObj.Port_Error<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;Port Error : &quot; &amp; ex.ToString)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Sub<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Private Sub Comms_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles Comms.DataReceived<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If _Debug Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;Port Incomming&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _InBuffer = &quot;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim Tmpcnt As Integer = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim Strlen As String = &quot;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _InBuffer = _InBuffer &amp; Chr(Comms.ReadByte)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Loop Until Comms.BytesToRead = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ''''Pause and let the buffer fill up ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.Threading.Thread.Sleep(_BufferTime)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Loop Until Comms.BytesToRead = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Catch ex As Exception<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Status = ComVals.StatusObj.Port_Error<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Err = ex.ToString<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Lets start working with the data..<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If _Debug Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaiseEvent DebugE(&quot;PORT Input:&quot; &amp; _InBuffer)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Select Case _Status<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Case ComVals.StatusObj.Port_Scan<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If _InBuffer.StartsWith(&quot;SM!ID&quot;) Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ReplyReceived = True<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Exit Sub<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End Select<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Sub</code><hr />
</div> What have i done wrong, that the service simply does not wana connect to the serial port ???? Must i use a different serial object... Been going nuts on this for the last week now.... Please help .....</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>GremlinSA</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537211-RESOLVED-Com-Ports-in-a-Service...</guid>
		</item>
		<item>
			<title><![CDATA[Determine if a DataGridView's horizontal scroll bar exists?]]></title>
			<link>http://forums.codeguru.com/showthread.php?537179-Determine-if-a-DataGridView-s-horizontal-scroll-bar-exists&amp;goto=newpost</link>
			<pubDate>Tue, 21 May 2013 15:29:28 GMT</pubDate>
			<description><![CDATA[Visual Basic 2010, .NET 3.5 Is there a way to pragmatically determine if a DataGridView's horizontal scroll bar is active or visible? I need to move a few items about when the DGV's horizontal scroll bar comes on]]></description>
			<content:encoded><![CDATA[<div>Visual Basic 2010, .NET 3.5 Is there a way to pragmatically determine if a DataGridView's horizontal scroll bar is active or visible? I need to move a few items about when the DGV's horizontal scroll bar comes on</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>DinoVaught</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537179-Determine-if-a-DataGridView-s-horizontal-scroll-bar-exists</guid>
		</item>
		<item>
			<title>Get Grayscale Value of grayscale image (RGB)</title>
			<link>http://forums.codeguru.com/showthread.php?537137-Get-Grayscale-Value-of-grayscale-image-(RGB)&amp;goto=newpost</link>
			<pubDate>Mon, 20 May 2013 07:09:30 GMT</pubDate>
			<description><![CDATA[I'm making simple application for image recognition using grayscale image format. The problem is how to get the value of a grayscale image. Its value is RGB or pixel. Then the value will be used as a comparison between the sample images with the image to be recognized.

I have a sample program but can not use this code to VB.net, because the code for vb.6. Can someone help me convert this code to vb.net? Or do you have another solution?

I was more expecting another solution to this problem in VB.net code.

Thank you very much

Code:
---------
For Y = 1 to Picture1.scaleheight
For x = 1 to Picture1.ScaleWidht

p = Get pixel (picture1.hdc, X,Y)
r= p and &HFF
g = (p\&H100)and &HFF
b = (p\&H10000)and &HFF

grtotr=grtotr + r
grratr = Round(gtotr/(picture1.ScaleHeight*Picture1.Scalewidht),2)

grtotg=grtotg + g
grratg = Round(gtotg/(picture1.ScaleHeight*Picture1.Scalewidht),2)

grtotb=grtotb + b
grratb = Round(gtotb/(picture1.ScaleHeight*Picture1.Scalewidht),2)

Next
Next
' the result of the calculation transferred to textbox
Text1.text = grratr ' R value
Text2.text = ggratg 'G value
Text3.text = ggratb ' B value
---------
]]></description>
			<content:encoded><![CDATA[<div>I'm making simple application for image recognition using grayscale image format. The problem is how to get the value of a grayscale image. Its value is RGB or pixel. Then the value will be used as a comparison between the sample images with the image to be recognized.<br />
<br />
I have a sample program but can not use this code to VB.net, because the code for vb.6. Can someone help me convert this code to vb.net? Or do you have another solution?<br />
<br />
I was more expecting another solution to this problem in VB.net code.<br />
<br />
Thank you very much<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">For Y = 1 to Picture1.scaleheight<br />
For x = 1 to Picture1.ScaleWidht<br />
<br />
p = Get pixel (picture1.hdc, X,Y)<br />
r= p and &amp;HFF<br />
g = (p\&amp;H100)and &amp;HFF<br />
b = (p\&amp;H10000)and &amp;HFF<br />
<br />
grtotr=grtotr + r<br />
grratr = Round(gtotr/(picture1.ScaleHeight*Picture1.Scalewidht),2)<br />
<br />
grtotg=grtotg + g<br />
grratg = Round(gtotg/(picture1.ScaleHeight*Picture1.Scalewidht),2)<br />
<br />
grtotb=grtotb + b<br />
grratb = Round(gtotb/(picture1.ScaleHeight*Picture1.Scalewidht),2)<br />
<br />
Next<br />
Next<br />
' the result of the calculation transferred to textbox<br />
Text1.text = grratr ' R value<br />
Text2.text = ggratg 'G value<br />
Text3.text = ggratb ' B value</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>Jamil Nur M</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537137-Get-Grayscale-Value-of-grayscale-image-(RGB)</guid>
		</item>
		<item>
			<title>Saving Controls to File - Help!</title>
			<link>http://forums.codeguru.com/showthread.php?537073-Saving-Controls-to-File-Help!&amp;goto=newpost</link>
			<pubDate>Fri, 17 May 2013 16:27:15 GMT</pubDate>
			<description><![CDATA[In VB 2005, I have a form with a panel control. On right-click of the panel, a context menu displays different types of controls the user can add (at runtime) to the form by clicking the menu items. At runtime, the user adds a variable number of different controls to the form by performing this task mutliple times.

My goal is to have the form remember all of the controls upon form.closing and reload them on form.load, but I'm not sure how to go about translating between control objects and text. Ideally, I'd like to iterate through the panel's controls, and write all properties of each control to a file; but I have no idea how to translate a control object into text (capturing -all- of its properties), or vice versa (creating a control from a comprehensive property list in text/list/etc).

I'd also like to be able to store all of the parent form's controls and their properties, and the form's global variables. Depending on how this can be achieved, I might need to use multiple files for persisting the data (maybe even one per control), but I'm stuck at the translation part.

It's not as easy as grabbing a textbox's .text property, because I also need its .backcolor and everything else. Additionally, some controls have properties that others don't have; so if I wrote a method to iterate through a passed control's .backcolor, .borderstyle, ... , .tag, .text, ... then I'd miss the unique ones (like listbox/combobox .items, checkbox .checked, etc). Is there a way to simply iterate through all properties of a given control and reference the name and value of each?

Help!]]></description>
			<content:encoded><![CDATA[<div>In VB 2005, I have a form with a panel control. On right-click of the panel, a context menu displays different types of controls the user can add (at runtime) to the form by clicking the menu items. At runtime, the user adds a variable number of different controls to the form by performing this task mutliple times.<br />
<br />
My goal is to have the form remember all of the controls upon form.closing and reload them on form.load, but I'm not sure how to go about translating between control objects and text. Ideally, I'd like to iterate through the panel's controls, and write all properties of each control to a file; but I have no idea how to translate a control object into text (capturing -all- of its properties), or vice versa (creating a control from a comprehensive property list in text/list/etc).<br />
<br />
I'd also like to be able to store all of the parent form's controls and their properties, and the form's global variables. Depending on how this can be achieved, I might need to use multiple files for persisting the data (maybe even one per control), but I'm stuck at the translation part.<br />
<br />
It's not as easy as grabbing a textbox's .text property, because I also need its .backcolor and everything else. Additionally, some controls have properties that others don't have; so if I wrote a method to iterate through a passed control's .backcolor, .borderstyle, ... , .tag, .text, ... then I'd miss the unique ones (like listbox/combobox .items, checkbox .checked, etc). Is there a way to simply iterate through all properties of a given control and reference the name and value of each?<br />
<br />
Help!</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>aatc1985</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537073-Saving-Controls-to-File-Help!</guid>
		</item>
		<item>
			<title>Convert PDF to other formats, Add Floating Boxes in New or Existence PDF Files</title>
			<link>http://forums.codeguru.com/showthread.php?537063-Convert-PDF-to-other-formats-Add-Floating-Boxes-in-New-or-Existence-PDF-Files&amp;goto=newpost</link>
			<pubDate>Fri, 17 May 2013 09:58:55 GMT</pubDate>
			<description>The latest version of * Aspose.Pdf for .NET (8.0.0)  (http://www.aspose.com/community/files/51/.net-components/aspose.pdf-for-.net/entry466094.aspx)* has been released. This release includes better support for existing file manipulation. This new release has specific improvements for PDF printing, PDF to DOC, XPS and various image format conversions. We have also focused on watermarking, text extraction, PDF compression and bookmarking functionalities. Please note that we recently introduced an Examples dashboard which contains code examples for Aspose.Total for .NET products. From this release, the Examples dashboard is part of the product installer. So once you have installed this new version, you can find the Examples dashboard in the Examples folder in * Aspose.Pdf for .NET’s  (http://www.aspose.com/.net/pdf-component.aspx)* product installation directory. This release includes plenty of new and improved features as listed below

•	Disable paging in PDF document
•	Update Validate(..) method to take Stream object as an argument
•	Examples dashboard with Aspose.Pdf for .NET
•	Cell Text Wrapping issue in Table Row is fixed
•	PDF to PNG conversion issue is resolved
•	Complete text is now extracted from PDF file
•	Using unicode characters in TOC
•	Unable to extract/get page number information regarding bookmarks
•	Pdf printing now working printing images
•	PDF to PNG: Conversion process hanging is fixed
•	Image rendered as black while converting Pdf to JPG is fixed
•	Printing halting is resolved for indefinite time
•	While printing using PdfViewer, data missing in footer is fixed
•	Opacity property of FreeTextAnnotation is now working
•	PDF to XPS: resultant file is now corrected
•	PDF to DOC: Bullets and frame container missing is fixed
•	OptimizeResources(), error message is fixed when viewing resultant PDF
•	FreeTextAnnotation contains multiline international characters, result is broken
•	Multi-page table rendering properly is fixed
•	Error fixed while concatenating PDF files
•	Watermark is now being added to PDF document
•	Checkboxes appearanceis fixed on first page footer and remaining pages
•	All output PDFs are of the same size as input PDF
•	How to embed and extract blank data in XMP
•	While filling a richtextbox field, line break tag in XML not working
•	Unable to clear Keywords property is now fixed
•	Process hanging is fixed while converting Pdf to Tiff
•	Aspose.PDF 7.8 is showing missing dependency error is now fixed
•	PDF concatenation, bookmarks are now being included in resultant file
•	Concatenate attached Pdf files is now fixed
•	Assemblies referenced in Aspose.Pdf for .Net 7.8.0 but missing in build is fixed
•	Multiline TexboxField now honor new line
•	Textfragment now implementing Bold and italic fontstyles simultaneously
•	Different footer on last page of PDF file is resolved

Other most recent bug fixes are also included in this release.</description>
			<content:encoded><![CDATA[<div>The latest version of <b><a rel="nofollow" href="http://www.aspose.com/community/files/51/.net-components/aspose.pdf-for-.net/entry466094.aspx" target="_blank"> Aspose.Pdf for .NET (8.0.0) </a></b> has been released. This release includes better support for existing file manipulation. This new release has specific improvements for PDF printing, PDF to DOC, XPS and various image format conversions. We have also focused on watermarking, text extraction, PDF compression and bookmarking functionalities. Please note that we recently introduced an Examples dashboard which contains code examples for Aspose.Total for .NET products. From this release, the Examples dashboard is part of the product installer. So once you have installed this new version, you can find the Examples dashboard in the Examples folder in <b><a rel="nofollow" href="http://www.aspose.com/.net/pdf-component.aspx" target="_blank"> Aspose.Pdf for .NET’s </a></b> product installation directory. This release includes plenty of new and improved features as listed below<br />
<br />
•	Disable paging in PDF document<br />
•	Update Validate(..) method to take Stream object as an argument<br />
•	Examples dashboard with Aspose.Pdf for .NET<br />
•	Cell Text Wrapping issue in Table Row is fixed<br />
•	PDF to PNG conversion issue is resolved<br />
•	Complete text is now extracted from PDF file<br />
•	Using unicode characters in TOC<br />
•	Unable to extract/get page number information regarding bookmarks<br />
•	Pdf printing now working printing images<br />
•	PDF to PNG: Conversion process hanging is fixed<br />
•	Image rendered as black while converting Pdf to JPG is fixed<br />
•	Printing halting is resolved for indefinite time<br />
•	While printing using PdfViewer, data missing in footer is fixed<br />
•	Opacity property of FreeTextAnnotation is now working<br />
•	PDF to XPS: resultant file is now corrected<br />
•	PDF to DOC: Bullets and frame container missing is fixed<br />
•	OptimizeResources(), error message is fixed when viewing resultant PDF<br />
•	FreeTextAnnotation contains multiline international characters, result is broken<br />
•	Multi-page table rendering properly is fixed<br />
•	Error fixed while concatenating PDF files<br />
•	Watermark is now being added to PDF document<br />
•	Checkboxes appearanceis fixed on first page footer and remaining pages<br />
•	All output PDFs are of the same size as input PDF<br />
•	How to embed and extract blank data in XMP<br />
•	While filling a richtextbox field, line break tag in XML not working<br />
•	Unable to clear Keywords property is now fixed<br />
•	Process hanging is fixed while converting Pdf to Tiff<br />
•	Aspose.PDF 7.8 is showing missing dependency error is now fixed<br />
•	PDF concatenation, bookmarks are now being included in resultant file<br />
•	Concatenate attached Pdf files is now fixed<br />
•	Assemblies referenced in Aspose.Pdf for .Net 7.8.0 but missing in build is fixed<br />
•	Multiline TexboxField now honor new line<br />
•	Textfragment now implementing Bold and italic fontstyles simultaneously<br />
•	Different footer on last page of PDF file is resolved<br />
<br />
Other most recent bug fixes are also included in this release.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>aspose</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537063-Convert-PDF-to-other-formats-Add-Floating-Boxes-in-New-or-Existence-PDF-Files</guid>
		</item>
		<item>
			<title>Datagridview Checkbox</title>
			<link>http://forums.codeguru.com/showthread.php?536949-Datagridview-Checkbox&amp;goto=newpost</link>
			<pubDate>Mon, 13 May 2013 11:12:03 GMT</pubDate>
			<description><![CDATA[Hi all,

I have the following codes:


Code:
---------
    Private Sub dgCustomerPackage_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgCustomerPackage.CellClick
        If TypeOf dgCustomerPackage.CurrentCell Is DataGridViewCheckBoxCell Then
            If 1 + 1 = 2 Then
                dgCustomerPackage.CurrentRow.Cells("colchkSelect").Value = 0
            Else
                dgCustomerPackage.CurrentRow.Cells("colchkSelect").Value = 1
            End If
        End If
    End Sub
---------
I am wondering why my "colchkSelect" will be checked even though the above codes showing that it should not be checked when the cell click event?]]></description>
			<content:encoded><![CDATA[<div>Hi all,<br />
<br />
I have the following codes:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; Private Sub dgCustomerPackage_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgCustomerPackage.CellClick<br />
&nbsp; &nbsp; &nbsp; &nbsp; If TypeOf dgCustomerPackage.CurrentCell Is DataGridViewCheckBoxCell Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If 1 + 1 = 2 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dgCustomerPackage.CurrentRow.Cells(&quot;colchkSelect&quot;).Value = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dgCustomerPackage.CurrentRow.Cells(&quot;colchkSelect&quot;).Value = 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; End Sub</code><hr />
</div> I am wondering why my &quot;colchkSelect&quot; will be checked even though the above codes showing that it should not be checked when the cell click event?</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>daniel50096230</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536949-Datagridview-Checkbox</guid>
		</item>
		<item>
			<title>(VB)-media control interface using V.Studio 2008???</title>
			<link>http://forums.codeguru.com/showthread.php?536937-(VB)-media-control-interface-using-V.Studio-2008&amp;goto=newpost</link>
			<pubDate>Sun, 12 May 2013 22:10:54 GMT</pubDate>
			<description><![CDATA[Hello,

I had installed visual basic 6.0 on my pc and I used the Microsoft Multimedia Control 6.0(SP3) component when I wanted to add Media Control Interface-MCI Control on my project.

Now I use visual Studio.net 2008 and I don't know how to add MCI Control on my project. There is no such object on toolbox. Can you help me? 

Thank you in advance]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I had installed visual basic 6.0 on my pc and I used the Microsoft Multimedia Control 6.0(SP3) component when I wanted to add Media Control Interface-MCI Control on my project.<br />
<br />
Now I use visual Studio.net 2008 and I don't know how to add MCI Control on my project. There is no such object on toolbox. Can you help me? <br />
<br />
Thank you in advance</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>menmas</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536937-(VB)-media-control-interface-using-V.Studio-2008</guid>
		</item>
		<item>
			<title>Send UDP data to an iPhone app</title>
			<link>http://forums.codeguru.com/showthread.php?536883-Send-UDP-data-to-an-iPhone-app&amp;goto=newpost</link>
			<pubDate>Thu, 09 May 2013 10:45:21 GMT</pubDate>
			<description><![CDATA[Hi to all,
I have developed an iPhone/iPad app called iDatanet which lets you listen to a stream of UDP data off a specified port with a very simple protocol:
iDataNet@var1;val1@var2;val2@var3;val3 (… etc …)

I have a devloped quite a few programs in Visual Basic .Net which send data over the wifi using this UDP protocol to the app.
It works great, but I need some people to help me test it out and see if there are any bugs.
The app is currently free and can be downloaded at:
https://itunes.apple.com/us/app/idatanet/id618208907?ls=1&mt=8

In the app you can then configure various pages with displays showing the incoming pairs of variables (or labels) and values (which can be numbers or words).
If you need some VB code send me a private message and I will email it to you. Also I would be curious to hear if people have an idea of what applications this could have in real life?
I'm thinking, industry, universities, hostpitals... Any thing you can think of?
Thanks!

Cyrille]]></description>
			<content:encoded><![CDATA[<div>Hi to all,<br />
I have developed an iPhone/iPad app called iDatanet which lets you listen to a stream of UDP data off a specified port with a very simple protocol:<br />
iDataNet@var1;val1@var2;val2@var3;val3 (… etc …)<br />
<br />
I have a devloped quite a few programs in Visual Basic .Net which send data over the wifi using this UDP protocol to the app.<br />
It works great, but I need some people to help me test it out and see if there are any bugs.<br />
The app is currently free and can be downloaded at:<br />
<a rel="nofollow" href="https://itunes.apple.com/us/app/idatanet/id618208907?ls=1&amp;mt=8" target="_blank">https://itunes.apple.com/us/app/idat...8907?ls=1&amp;mt=8</a><br />
<br />
In the app you can then configure various pages with displays showing the incoming pairs of variables (or labels) and values (which can be numbers or words).<br />
If you need some VB code send me a private message and I will email it to you. Also I would be curious to hear if people have an idea of what applications this could have in real life?<br />
I'm thinking, industry, universities, hostpitals... Any thing you can think of?<br />
Thanks!<br />
<br />
Cyrille</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>Cyrille Douillet</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536883-Send-UDP-data-to-an-iPhone-app</guid>
		</item>
		<item>
			<title>VBA Excel 2007 Application.WorksheetFunction.Match help...</title>
			<link>http://forums.codeguru.com/showthread.php?536863-VBA-Excel-2007-Application.WorksheetFunction.Match-help...&amp;goto=newpost</link>
			<pubDate>Wed, 08 May 2013 18:34:45 GMT</pubDate>
			<description><![CDATA[Good day everyone,
                                I hope i'm in the right place for VB Excel questions.

I have difficulty finding an answer to my problem. I have a workbook set up for the type of job I’m doing. My codes are mostly mine own and help from others…including multiple website with excel help. 
I have hit a wall with all the information passing through I am just lost when it comes to complex coding. 

I have a sub Test that includes an MsgBox Application.WorksheetFunction.Match code. 

I can’t upload my workbook as there is way too much information. 

I have 7 sheets set up, one of them is for my normal control (Hidden sheet) and I have a “Archives” sheet that is also hidden for data and code purpose. 

So 5 sheet with a flow, meaning that “The user” will start from sheet1 and work his way to sheet 2 and so on. It is possible to go on any 5 sheets. Depending on what the user is working on. But mainly, it goes from one sheet to the other. 

The process is kind of too big to explain on here but I am new, so just wondering what kind of info will be required. 
This is kind of what I’m looking for… 

The workbook is based on ActiveCell.row method and also Application.WorksheetFunction.Match. Every time you will select a row or a cell and click on the command button “Complete” it will look up in sheet5 and match column A to find the exact same info from Sheet3.

I need to incorporate the following code in my sheet3
        

Code:
---------
For Each Cell In ActiveCell
            If Cell.Value Like "*[!0-9]/[A-Z]" Then
                Cell.Value = Left(Cell.Value, Len(Cell.Value) - 2)
            End If
        Next Cell
---------
So that each time I make a transfer it will delete the /A from my Evaluation but also look in my sheet5 then delete the /A then do the initial Transfer.

I would love to insert my workbook for explanation but unfortunately that will not be possible… Posting codes is not an issue.]]></description>
			<content:encoded><![CDATA[<div>Good day everyone,<br />
                                I hope i'm in the right place for VB Excel questions.<br />
<br />
I have difficulty finding an answer to my problem. I have a workbook set up for the type of job I’m doing. My codes are mostly mine own and help from others…including multiple website with excel help. <br />
I have hit a wall with all the information passing through I am just lost when it comes to complex coding. <br />
<br />
I have a sub Test that includes an MsgBox Application.WorksheetFunction.Match code. <br />
<br />
I can’t upload my workbook as there is way too much information. <br />
<br />
I have 7 sheets set up, one of them is for my normal control (Hidden sheet) and I have a “Archives” sheet that is also hidden for data and code purpose. <br />
<br />
So 5 sheet with a flow, meaning that “The user” will start from sheet1 and work his way to sheet 2 and so on. It is possible to go on any 5 sheets. Depending on what the user is working on. But mainly, it goes from one sheet to the other. <br />
<br />
The process is kind of too big to explain on here but I am new, so just wondering what kind of info will be required. <br />
This is kind of what I’m looking for… <br />
<br />
The workbook is based on ActiveCell.row method and also Application.WorksheetFunction.Match. Every time you will select a row or a cell and click on the command button “Complete” it will look up in sheet5 and match column A to find the exact same info from Sheet3.<br />
<br />
I need to incorporate the following code in my sheet3<br />
        <br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">For Each Cell In ActiveCell<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Cell.Value Like &quot;*[!0-9]/[A-Z]&quot; Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cell.Value = Left(Cell.Value, Len(Cell.Value) - 2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; Next Cell</code><hr />
</div> So that each time I make a transfer it will delete the /A from my Evaluation but also look in my sheet5 then delete the /A then do the initial Transfer.<br />
<br />
I would love to insert my workbook for explanation but unfortunately that will not be possible… Posting codes is not an issue.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>Excelnoub</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536863-VBA-Excel-2007-Application.WorksheetFunction.Match-help...</guid>
		</item>
		<item>
			<title>Random Sort</title>
			<link>http://forums.codeguru.com/showthread.php?536715-Random-Sort&amp;goto=newpost</link>
			<pubDate>Fri, 03 May 2013 04:16:37 GMT</pubDate>
			<description>Hi all,

Good day. I am facing a problem here in sorting. I has a list of ID selected from database. The list of ID is the following:

AH
AJ
AP
AW
AZ

How can I sort the ID where the ID that I select should be always on top, then only sort by ascending?

For example, I select AP. So the sorting should be like this:
AP, AH,AJ,AW,AZ</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
<br />
Good day. I am facing a problem here in sorting. I has a list of ID selected from database. The list of ID is the following:<br />
<br />
AH<br />
AJ<br />
AP<br />
AW<br />
AZ<br />
<br />
How can I sort the ID where the ID that I select should be always on top, then only sort by ascending?<br />
<br />
For example, I select AP. So the sorting should be like this:<br />
AP, AH,AJ,AW,AZ</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>daniel50096230</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536715-Random-Sort</guid>
		</item>
		<item>
			<title>VB2010 help wanted.</title>
			<link>http://forums.codeguru.com/showthread.php?536657-VB2010-help-wanted.&amp;goto=newpost</link>
			<pubDate>Tue, 30 Apr 2013 20:39:35 GMT</pubDate>
			<description><![CDATA[I am building a WAR card game program using images, arrays, and a shuffle sub. Can anyone help me get it working right. I can't get the program to add scores into the text-boxes assigned. I also need to get the shuffle sub to work using the designated button. When shuffle is pushed the score is not to be cleared.


Code:
---------
Public Class Form1
    Dim img1, img2, img3, p1p, p2p, dec As Image
    Dim value(11) As Integer

    Private Sub btnShuffle_Click(sender As System.Object, e As System.EventArgs) Handles btnShuffle.Click

    End Sub

    Private Sub btnDraw_Click(sender As System.Object, e As System.EventArgs) Handles btnDraw.Click

        boom(img1)
        Player1Play.Image = img1
        boom(img2)
        Player2Play.Image = img2
        boomer(img3)
        Decision.Image = img3
        p1p = Player1Play.Image
        p2p = Player2Play.Image
        dec = Decision.Image
        If p1p = 1 And p2p <= 2 Then

        End If
    End Sub

    Private Sub btnClear_Click(sender As System.Object, e As System.EventArgs) Handles btnClear.Click
        P1score.Text = 0
        P2score.Text = 0
    End Sub

    Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click
        Close()
    End Sub

    Public Sub shuffel()
        Dim switch, number_of_cards, value(51), tempval As Integer
        Dim tempcard, card(12) As Image

        number_of_cards = 52

        For i = 1 To number_of_cards
            switch = Int(Rnd() * number_of_cards + 1)
            tempval = value(i)
            value(i) = value(switch)
            value(switch) = tempval
            tempcard = card(i)
            card(i) = card(switch)
            card(switch) = tempcard
        Next
    End Sub
    
    Sub boom(ByRef imgPop)

        Dim intRand As Integer

        intRand = Int(Rnd(51) * 10) + 1

        If intRand = 1 Then
            imgPop = My.Resources.aceh
        ElseIf intRand = 2 Then
            imgPop = My.Resources.twoh
        ElseIf intRand = 3 Then
            imgPop = My.Resources.threeh
        ElseIf intRand = 4 Then
            imgPop = My.Resources.fourh
        ElseIf intRand = 5 Then
            imgPop = My.Resources.fiveh
        ElseIf intRand = 6 Then
            imgPop = My.Resources.sixh
        ElseIf intRand = 7 Then
            imgPop = My.Resources.sevenh
        ElseIf intRand = 8 Then
            imgPop = My.Resources.eighth
        ElseIf intRand = 9 Then
            imgPop = My.Resources.nineh
        ElseIf intRand = 10 Then
            imgPop = My.Resources.tenh
        ElseIf intRand = 11 Then
            imgPop = My.Resources.jackh
        ElseIf intRand = 12 Then
            imgPop = My.Resources.queenh
        ElseIf intRand = 13 Then
            imgPop = My.Resources.kingh
        ElseIf intRand = 14 Then
            imgPop = My.Resources.acec
        ElseIf intRand = 15 Then
            imgPop = My.Resources.twoc
        ElseIf intRand = 16 Then
            imgPop = My.Resources.threec
        ElseIf intRand = 17 Then
            imgPop = My.Resources.fourc
        ElseIf intRand = 18 Then
            imgPop = My.Resources.fivec
        ElseIf intRand = 19 Then
            imgPop = My.Resources.sixc
        ElseIf intRand = 20 Then
            imgPop = My.Resources.sevenc
        ElseIf intRand = 21 Then
            imgPop = My.Resources.eightc
        ElseIf intRand = 22 Then
            imgPop = My.Resources.ninec
        ElseIf intRand = 23 Then
            imgPop = My.Resources.tenc
        ElseIf intRand = 24 Then
            imgPop = My.Resources.jackc
        ElseIf intRand = 25 Then
            imgPop = My.Resources.queenc
        ElseIf intRand = 26 Then
            imgPop = My.Resources.kingc
        ElseIf intRand = 27 Then
            imgPop = My.Resources.aced
        ElseIf intRand = 28 Then
            imgPop = My.Resources.twod
        ElseIf intRand = 29 Then
            imgPop = My.Resources.threed
        ElseIf intRand = 30 Then
            imgPop = My.Resources.fourd
        ElseIf intRand = 31 Then
            imgPop = My.Resources.fived
        ElseIf intRand = 32 Then
            imgPop = My.Resources.sixd
        ElseIf intRand = 33 Then
            imgPop = My.Resources.sevend
        ElseIf intRand = 34 Then
            imgPop = My.Resources.eightd
        ElseIf intRand = 35 Then
            imgPop = My.Resources.nined
        ElseIf intRand = 36 Then
            imgPop = My.Resources.tend
        ElseIf intRand = 37 Then
            imgPop = My.Resources.jackd
        ElseIf intRand = 38 Then
            imgPop = My.Resources.queend
        ElseIf intRand = 39 Then
            imgPop = My.Resources.kingd
        ElseIf intRand = 40 Then
            imgPop = My.Resources.aces
        ElseIf intRand = 41 Then
            imgPop = My.Resources.twos
        ElseIf intRand = 42 Then
            imgPop = My.Resources.threes
        ElseIf intRand = 43 Then
            imgPop = My.Resources.fours
        ElseIf intRand = 44 Then
            imgPop = My.Resources.fives
        ElseIf intRand = 45 Then
            imgPop = My.Resources.sixs
        ElseIf intRand = 46 Then
            imgPop = My.Resources.sevens
        ElseIf intRand = 47 Then
            imgPop = My.Resources.eights
        ElseIf intRand = 48 Then
            imgPop = My.Resources.nines
        ElseIf intRand = 49 Then
            imgPop = My.Resources.tens
        ElseIf intRand = 50 Then
            imgPop = My.Resources.jacks
        ElseIf intRand = 51 Then
            imgPop = My.Resources.queens
        ElseIf intRand = 52 Then
            imgPop = My.Resources.kings
        Else
            MessageBox.Show("Error")
        End If
    End Sub

    Sub boomer(ByRef imgPopper)

        Dim inRand As Integer
        If inRand = 1 Then
            imgPopper = My.Resources.winleft
        ElseIf inRand = 2 Then
            imgPopper = My.Resources.winright
        ElseIf inRand = 3 Then
            imgPopper = My.Resources.tie
        Else
            MessageBox.Show("Error 2")
        End If
    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Randomize()
---------
]]></description>
			<content:encoded><![CDATA[<div>I am building a WAR card game program using images, arrays, and a shuffle sub. Can anyone help me get it working right. I can't get the program to add scores into the text-boxes assigned. I also need to get the shuffle sub to work using the designated button. When shuffle is pushed the score is not to be cleared.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">Public Class Form1<br />
&nbsp; &nbsp; Dim img1, img2, img3, p1p, p2p, dec As Image<br />
&nbsp; &nbsp; Dim value(11) As Integer<br />
<br />
&nbsp; &nbsp; Private Sub btnShuffle_Click(sender As System.Object, e As System.EventArgs) Handles btnShuffle.Click<br />
<br />
&nbsp; &nbsp; End Sub<br />
<br />
&nbsp; &nbsp; Private Sub btnDraw_Click(sender As System.Object, e As System.EventArgs) Handles btnDraw.Click<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; boom(img1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; Player1Play.Image = img1<br />
&nbsp; &nbsp; &nbsp; &nbsp; boom(img2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; Player2Play.Image = img2<br />
&nbsp; &nbsp; &nbsp; &nbsp; boomer(img3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; Decision.Image = img3<br />
&nbsp; &nbsp; &nbsp; &nbsp; p1p = Player1Play.Image<br />
&nbsp; &nbsp; &nbsp; &nbsp; p2p = Player2Play.Image<br />
&nbsp; &nbsp; &nbsp; &nbsp; dec = Decision.Image<br />
&nbsp; &nbsp; &nbsp; &nbsp; If p1p = 1 And p2p &lt;= 2 Then<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; End Sub<br />
<br />
&nbsp; &nbsp; Private Sub btnClear_Click(sender As System.Object, e As System.EventArgs) Handles btnClear.Click<br />
&nbsp; &nbsp; &nbsp; &nbsp; P1score.Text = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; P2score.Text = 0<br />
&nbsp; &nbsp; End Sub<br />
<br />
&nbsp; &nbsp; Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click<br />
&nbsp; &nbsp; &nbsp; &nbsp; Close()<br />
&nbsp; &nbsp; End Sub<br />
<br />
&nbsp; &nbsp; Public Sub shuffel()<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim switch, number_of_cards, value(51), tempval As Integer<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim tempcard, card(12) As Image<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; number_of_cards = 52<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; For i = 1 To number_of_cards<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch = Int(Rnd() * number_of_cards + 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempval = value(i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value(i) = value(switch)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value(switch) = tempval<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempcard = card(i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card(i) = card(switch)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card(switch) = tempcard<br />
&nbsp; &nbsp; &nbsp; &nbsp; Next<br />
&nbsp; &nbsp; End Sub<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; Sub boom(ByRef imgPop)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim intRand As Integer<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; intRand = Int(Rnd(51) * 10) + 1<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; If intRand = 1 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.aceh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 2 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.twoh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 3 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.threeh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 4 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.fourh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 5 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.fiveh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 6 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.sixh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 7 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.sevenh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 8 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.eighth<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 9 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.nineh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 10 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.tenh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 11 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.jackh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 12 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.queenh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 13 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.kingh<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 14 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.acec<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 15 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.twoc<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 16 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.threec<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 17 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.fourc<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 18 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.fivec<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 19 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.sixc<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 20 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.sevenc<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 21 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.eightc<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 22 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.ninec<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 23 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.tenc<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 24 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.jackc<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 25 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.queenc<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 26 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.kingc<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 27 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.aced<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 28 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.twod<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 29 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.threed<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 30 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.fourd<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 31 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.fived<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 32 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.sixd<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 33 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.sevend<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 34 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.eightd<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 35 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.nined<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 36 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.tend<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 37 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.jackd<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 38 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.queend<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 39 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.kingd<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 40 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.aces<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 41 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.twos<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 42 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.threes<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 43 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.fours<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 44 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.fives<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 45 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.sixs<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 46 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.sevens<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 47 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.eights<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 48 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.nines<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 49 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.tens<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 50 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.jacks<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 51 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.queens<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf intRand = 52 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPop = My.Resources.kings<br />
&nbsp; &nbsp; &nbsp; &nbsp; Else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(&quot;Error&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; End Sub<br />
<br />
&nbsp; &nbsp; Sub boomer(ByRef imgPopper)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim inRand As Integer<br />
&nbsp; &nbsp; &nbsp; &nbsp; If inRand = 1 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPopper = My.Resources.winleft<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf inRand = 2 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPopper = My.Resources.winright<br />
&nbsp; &nbsp; &nbsp; &nbsp; ElseIf inRand = 3 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgPopper = My.Resources.tie<br />
&nbsp; &nbsp; &nbsp; &nbsp; Else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(&quot;Error 2&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; End Sub<br />
<br />
&nbsp; &nbsp; Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load<br />
&nbsp; &nbsp; &nbsp; &nbsp; Randomize()</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>JohnF84</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536657-VB2010-help-wanted.</guid>
		</item>
		<item>
			<title>CLR Debbuger (F5) ignores some exceptions in Windows Form apps</title>
			<link>http://forums.codeguru.com/showthread.php?536585-CLR-Debbuger-(F5)-ignores-some-exceptions-in-Windows-Form-apps&amp;goto=newpost</link>
			<pubDate>Sun, 28 Apr 2013 08:56:36 GMT</pubDate>
			<description><![CDATA[Hello

When run (F5 Debug) a *Windows Form application* I'm working with, there is some exceptions that are not cacthed by CLR debbuger. But the same code in a *Console Application* every exceptions are cacthed.

Below, I post 2 simple code examples with errors.

Code example #1

Code:
---------
    Sub Main()
        Dim var(6) As Integer
        var(8) = 33   <------- EXCEPTION
    End Sub
---------
Code example #2

Code:
---------
    Sub Main()
        Dim Pila As New Stack(Of Integer)
        Pila.Push(5)
        Pila.Push(9)
        Pila.Push(3)
        Pila.Push(CInt("hello"))  <------ EXCEPTION
    End Sub
---------
This is important: note that in *Console App* these exceptions are captured by CLR debuuger, but in *Windows Form App* NOT !!! That's my problem.

I attached my default Debug menu - Exceptions configuration.

Attachment 31353 (http://forums.codeguru.com/attachment.php?attachmentid=31353)

Thanks!!!]]></description>
			<content:encoded><![CDATA[<div>Hello<br />
<br />
When run (F5 Debug) a <b>Windows Form application</b> I'm working with, there is some exceptions that are not cacthed by CLR debbuger. But the same code in a <b>Console Application</b> every exceptions are cacthed.<br />
<br />
Below, I post 2 simple code examples with errors.<br />
<br />
Code example #1<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; Sub Main()<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim var(6) As Integer<br />
&nbsp; &nbsp; &nbsp; &nbsp; var(8) = 33&nbsp;  &lt;------- EXCEPTION<br />
&nbsp; &nbsp; End Sub</code><hr />
</div> Code example #2<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; Sub Main()<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim Pila As New Stack(Of Integer)<br />
&nbsp; &nbsp; &nbsp; &nbsp; Pila.Push(5)<br />
&nbsp; &nbsp; &nbsp; &nbsp; Pila.Push(9)<br />
&nbsp; &nbsp; &nbsp; &nbsp; Pila.Push(3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; Pila.Push(CInt(&quot;hello&quot;))&nbsp; &lt;------ EXCEPTION<br />
&nbsp; &nbsp; End Sub</code><hr />
</div> This is important: note that in <b>Console App</b> these exceptions are captured by CLR debuuger, but in <b>Windows Form App</b> NOT !!! That's my problem.<br />
<br />
I attached my default Debug menu - Exceptions configuration.<br />
<br />
<a href="http://forums.codeguru.com/attachment.php?attachmentid=31353"  title="Name:  
Views: 
Size:  ">Attachment 31353</a><br />
<br />
Thanks!!!</div>


	<div style="padding:10px">

	

	
		<fieldset class="fieldset">
			<legend>Attached Images</legend>
			<div style="padding:10pxpx">
			<img class="attach" src="http://forums.codeguru.com/attachment.php?attachmentid=31353&amp;stc=1&amp;d=1367139322" alt="" />&nbsp; 
			</div>
		</fieldset>
	

	

	

	</div>
 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>LeoVB</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536585-CLR-Debbuger-(F5)-ignores-some-exceptions-in-Windows-Form-apps</guid>
		</item>
		<item>
			<title>VB.Net - Tab Pages with Controls</title>
			<link>http://forums.codeguru.com/showthread.php?536565-VB.Net-Tab-Pages-with-Controls&amp;goto=newpost</link>
			<pubDate>Sat, 27 Apr 2013 06:49:35 GMT</pubDate>
			<description><![CDATA[Sir,
I beginner for VB.Net programming, 
MS-Access is my DataBase, According to database single person has Few Rows. That mean when their repeat comes new row (record) will be added.
In Repeat Table of database has Few Fields like "PerID", "Repeat Times",  "Company",  "Date"

I need create Tab Pages to equal of repeat times and insert other Details into that Tab Page.

I code like this and its creates Tab Pages equal to repeat time. If person comes repeatedly 04 times Tab Control will added 04 New pages into Tab Control.


Code:
---------
Dim newPageAA As New TabPage()
          Dim RecCount As Integer

            While QReaderQ.Read()
                RecCount = RecCount + 1 ' Count How many Rows
            End While

            TabControl1.TabPages.Clear()

            For xXx = 1 To RecCount 
                newPageAA = New TabPage   'create new instance

                If xXx = 1 Then
                    newPageAA.Text = "Repeat - 1"
                Else
                    newPageAA.Text = "Repeat - " & xXx.ToString
                End If
                TabControl1.TabPages.Add(newPageAA)
            Next
---------
Now I want to put other details ("PerID", "Repeat Times",  "Company",  "Date") into Tab Pages with Text Boxes or Labels.
In 1st Tab page -----> I want to see 1st repeat time  "PerID", "Repeat Times",  "Company",  "Date" 
In 4th Tab page -----> I want to see 4th repeat time "PerID", "Repeat Times",  "Company",  "Date" .......
Please tell me, how to do this.. 
I not asking full code, but show me with little example code, because I am beginner for VB.Net.]]></description>
			<content:encoded><![CDATA[<div>Sir,<br />
I beginner for VB.Net programming, <br />
MS-Access is my DataBase, According to database single person has Few Rows. That mean when their repeat comes new row (record) will be added.<br />
In Repeat Table of database has Few Fields like &quot;PerID&quot;, &quot;Repeat Times&quot;,  &quot;Company&quot;,  &quot;Date&quot;<br />
<br />
I need create Tab Pages to equal of repeat times and insert other Details into that Tab Page.<br />
<br />
I code like this and its creates Tab Pages equal to repeat time. If person comes repeatedly 04 times Tab Control will added 04 New pages into Tab Control.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">Dim newPageAA As New TabPage()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim RecCount As Integer<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; While QReaderQ.Read()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RecCount = RecCount + 1 ' Count How many Rows<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End While<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TabControl1.TabPages.Clear()<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For xXx = 1 To RecCount <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newPageAA = New TabPage&nbsp;  'create new instance<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If xXx = 1 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newPageAA.Text = &quot;Repeat - 1&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newPageAA.Text = &quot;Repeat - &quot; &amp; xXx.ToString<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TabControl1.TabPages.Add(newPageAA)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Next</code><hr />
</div> Now I want to put other details (&quot;PerID&quot;, &quot;Repeat Times&quot;,  &quot;Company&quot;,  &quot;Date&quot;) into Tab Pages with Text Boxes or Labels.<br />
In 1st Tab page -----&gt; I want to see 1st repeat time  &quot;PerID&quot;, &quot;Repeat Times&quot;,  &quot;Company&quot;,  &quot;Date&quot; <br />
In 4th Tab page -----&gt; I want to see 4th repeat time &quot;PerID&quot;, &quot;Repeat Times&quot;,  &quot;Company&quot;,  &quot;Date&quot; .......<br />
Please tell me, how to do this.. <br />
I not asking full code, but show me with little example code, because I am beginner for VB.Net.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>pc20912</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536565-VB.Net-Tab-Pages-with-Controls</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] Pass data from BackgroundWorker to main thread?]]></title>
			<link>http://forums.codeguru.com/showthread.php?536481-RESOLVED-Pass-data-from-BackgroundWorker-to-main-thread&amp;goto=newpost</link>
			<pubDate>Tue, 23 Apr 2013 10:58:41 GMT</pubDate>
			<description><![CDATA[Hello

In a Windows Form, I need to delegate a lengthy action to a BackgroundWorker so that the main application doesn't freeze.

However, the code in the BackgroundWorker must send data back to the main application. This code from MSDN (http://msdn.microsoft.com/en-us/library/ms171728.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1) doesn't include how to do this:


Code:
---------
Private Sub setTextBackgroundWorkerBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setTextBackgroundWorkerBtn.Click
   Me.backgroundWorker1.RunWorkerAsync()
End Sub 

Private Sub backgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs) _
Handles backgroundWorker1.RunWorkerCompleted
   Me.textBox1.Text = "This text was set safely by BackgroundWorker." 
End Sub
---------
Is there a way for a BackgroundWorker object to send data back to the main app without using a global variable?

Thank you.]]></description>
			<content:encoded><![CDATA[<div>Hello<br />
<br />
In a Windows Form, I need to delegate a lengthy action to a BackgroundWorker so that the main application doesn't freeze.<br />
<br />
However, the code in the BackgroundWorker must send data back to the main application. <a rel="nofollow" href="http://msdn.microsoft.com/en-us/library/ms171728.aspx?cs-save-lang=1&amp;cs-lang=vb#code-snippet-1" target="_blank">This code from MSDN</a> doesn't include how to do this:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">Private Sub setTextBackgroundWorkerBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setTextBackgroundWorkerBtn.Click<br />
&nbsp;  Me.backgroundWorker1.RunWorkerAsync()<br />
End Sub <br />
<br />
Private Sub backgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs) _<br />
Handles backgroundWorker1.RunWorkerCompleted<br />
&nbsp;  Me.textBox1.Text = &quot;This text was set safely by BackgroundWorker.&quot; <br />
End Sub</code><hr />
</div> Is there a way for a BackgroundWorker object to send data back to the main app without using a global variable?<br />
<br />
Thank you.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?12-Visual-Basic-.NET">Visual Basic .NET</category>
			<dc:creator>littlebigman</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536481-RESOLVED-Pass-data-from-BackgroundWorker-to-main-thread</guid>
		</item>
	</channel>
</rss>
