Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16093

VS 2013 Updating a Datagridview function while running UI with serial comm

$
0
0
Hi guys,

What is the way to effectively populate a datatable with incoming serial data?

I've been reading around and found one closest to what I need (I think):

vb.net Code:
  1. Public Sub UpdateGrid(ByVal bytes_Input As Byte())
  2.         If Me.InvokeRequired Then
  3.             Me.Invoke(New MethodInvoker(AddressOf UpdateGrid()))
  4.         Else
  5.             Dim strTemp As New StringBuilder(bytes_Input.Length * 2)
  6.  
  7.             DataTableBuffer = New DataTable()
  8.             DataTableBuffer.Columns.Add("%")
  9.  
  10.             For Each b As Byte In bytes_Input
  11.                 strTemp.Append(Conversion.Hex(b))
  12.                 dr = DataTableBuffer.NewRow()
  13.                 dr("%") = Conversion.Hex(b)
  14.                 DataTableBuffer.Rows.Add(dr)
  15.             Next
  16.  
  17.             DataGridView1.DataSource = DataTableBuffer
  18.         End If
  19.     End Sub

But I'm getting "argument not specified for parameter" (as shown in attachment) and if I try filling it with "ByVal bytes_Input As Byte()" it is still going nowhere.

I'm still trying to get my head around this whole "invoke" business so any help understanding it would be appreciated too.

Thanks.
Attached Images
 

Viewing all articles
Browse latest Browse all 16093

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>