What have you tried so far?
What I would do is make a function that returned a List of Integers.
Each member of the list would be a random number between 0 and 100 minus (the sum of the list).

Of course, you should loop one-less time than 4 (or whatever count) and add the missing value to the last element.

This example uses Linq to sum the contents of the list for the first n digits.
When the sum reaches 100, only 0 would be added.
As long as the value stays less than 100 (or whatever max), it will continue adding.
The last number will be the difference of the sum subtracted from 100.
Check out how this works:

Imports System.Collections.Generic
Imports System.Linq
Module Module1
Function GetXRandomToMax(ByVal intCount As Integer, ByVal intValMax As Integer) As List(Of Integer)
Dim lst_intRetVal As New List(Of Integer)
Dim rnd As New Random(DateTime.Now.Ticks Mod Integer.MaxValue)
Dim intHolder As Integer = 0
For i As Integer = 1 To (intCount - 1)
intHolder = rnd.Next(0, intValMax - lst_intRetVal.Sum())
lst_intRetVal.Add(intHolder)
Next
lst_intRetVal.Add(intValMax - lst_intRetVal.Sum())
Return lst_intRetVal
End Function
Sub Main()
Dim lst As List(Of Integer) = GetXRandomToMax(4, 100)
lst.ForEach(Sub(i) System.Diagnostics.Debug.WriteLine(i))
End Sub
End Module

My suspicions are you will need to re-write the .Sum() because you won't be allowed to use Linq. Also, you will need to incorporate the function and take the values and populate your text boxes instead of this that writes out to the Debug window.

thanks for you help. below is what am trying to do. Though the generated four numbers is more than 100. how to i make the total of the four numbers 100

Dim total As Decimal
Dim data(4) As Decimal
Dim percentage(4) As Decimal
Dim number1 As Integer = 0, number2 As Integer = 0, number3 As Integer = 0, number4 As Integer = 0
'set random numbers
number1 = (100 * Rnd())
number2 = (100 * Rnd())
number3 = (100 * Rnd())
number4 = (100 * Rnd())
data(0) = number1
data(1) = number2
data(2) = number3
data(3) = number4
total = data(0) + data(1) + data(2) + data(3)
percentage(0) = data(0) / total
percentage(1) = data(1) / total
percentage(2) = data(2) / total
percentage(3) = data(3) / total

trying to draw a bar chat with the data. four bars

This is a simple code, that creates an array of 4 integers, and addes a random number to each index.

Dim r As New Random()
Dim nums As Integer() = New Integer(3) {0, 0, 0, 0}
For i As Integer = 0 To 3
If nums.Sum() <= 100 Then
nums(i) = r.[Next](1, 101)
Else
nums(i - 1) = 0
nums(i - 1) = 100 - nums.Sum()
Exit For
End If
Next
If nums.Sum() < 100 Then
nums(3) = 100 - (nums(0) + nums(1) + nums(2))
End If

I'm trying to compare 2 different CSV files, mark those differences respectively, then produce it as an output. However, my code seems to be only reading the last part of ...

I am becoming confused with visual studio v. Vb.net. I am findings hundreds of pieces of code tells me how to connect. Snippets elsewhere that tell me how to access ...