Hi

I am a new user in VBNet. Someboady Please help me to find the solution for the following.
Atpresent I am woking in a electronics based project. I measure the voltage and current measurements in to some string variables. So on each press of a button the values in the variable changes.
I want to display all these measurements (strings) in a single screen. That is I want to use the RealTime Display. There are 100+ values. So If I use 100+ lables in the form, the program becoming slow. So if I want to display 100+ strings, what is the solution. Can I use RichTextBox. If I can Use RichText box, how to program to display 100+ strings from different variables into a single RichTextBox. Thanks

Regards
Udhay

Recommended Answers

All 3 Replies

Dim String1 As String = "First String"
Dim String2 As String = "Second String"

' Or assign a value after declaration

String1 = "First String"
String2 = "Second String"

Label1.text = "Both String: " & String1 & String2

Kindly mark thread as solved.

commented: That is hardly an answer to his question. -2

What about using a grid. Would that be ok?

Well, assuming it is:

RNG class for test data:

Public Class RNG
	Public Shared Function GetRandomValues(ByVal arraySize As Integer)
		Dim result As New List(Of Integer)
		Dim i1 As Integer
		For i1 = 0 To arraySize - 1
			result.Add(GetRandomValue(500))
		Next
		Return result.ToArray()
	End Function

	Public Shared Function GetRandomValue(ByVal maxValue As Integer) As Integer
		Dim randomNumber(1) As Byte
		Dim gen As New System.Security.Cryptography.RNGCryptoServiceProvider()
		gen.GetBytes(randomNumber)
		Dim rand As Integer = Convert.ToInt32(randomNumber(1))
		Return rand Mod maxValue + 1
	End Function
End Class

Form:

Imports System.Data

Public Class Form1
	Dim dt As DataTable

	Private Sub RefreshData()
		If Not (dt Is Nothing) Then
			dt.Dispose()
			dt = Nothing
		End If
		dt = New DataTable()
		dt.Columns.Add(New DataColumn("Name", GetType(String)))
		dt.Columns.Add(New DataColumn("Value", GetType(Integer)))
		Dim vals() As Integer = RNG.GetRandomValues(100)
		Dim i1 As Integer
		For i1 = 0 To vals.Length - 1
			Dim row As DataRow = dt.NewRow()
			Dim strReadingName As String = "Reading #" + (i1 + 1).ToString()
			row("Name") = strReadingName
			row("Value") = vals(i1)
			dt.Rows.Add(row)
		Next
		DataGridView1.DataSource = dt
	End Sub

	Private Sub ButtonExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonExit.Click
		Me.Close()
	End Sub

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		RefreshData()
	End Sub
End Class

I have also attached the project.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.