Question print the the number

Renoald

New member
Joined
Nov 5, 2010
Messages
3
Programming Experience
Beginner
I have a series of number : 1 2 3 4 6 1 4 6 7 8 3 5 7 9
I want using vb console application to print out the number 1 2 3 4 5 6 7 8 9 , this mean only the unique number will be print out ( " there are two 1 in the series and only 1 times is print ou")
I think it many time , but still can't find out the best solution , any have idea about it , please discuss with me . Thank You
 
I have a series of number : 1 2 3 4 6 1 4 6 7 8 3 5 7 9
I want using vb console application to print out the number 1 2 3 4 5 6 7 8 9 , this mean only the unique number will be print out ( " there are two 1 in the series and only 1 times is print ou")
I think it many time , but still can't find out the best solution , any have idea about it , please discuss with me . Thank You

Hi
I think this code can help you!
In This Code , we have These objects:
Listbox : lbunique
Textbox: txtNumbers
Button: btnStart

Enjoy It!

''' <summary>
''' This Sub Use For Split Unique Number In String...
''' </summary>
''' <remarks></remarks>
Public Sub Spliter()
'Step 1 (Split One By One!)
For Each Ch As String In txtNumber.Text
'If The Number Is Unique
If Val(Ch) Mod 2 <> 0 Then

'Step 2 (If this Number There is not in the listbox)
For i As Integer = 0 To lbunique.Items.Count - 1
'There is
If lbunique.Items.Item(i).ToString = Ch Then
Exit Sub
End If
Next
'There is not in Listbox
lbunique.Items.Add(Ch)
End If
Next
Print("Numbers", lbunique)

Download Program Source(Solution)
Download
'------------------
 
Last edited:
This does the trick.

Imports System.Text
Module Module1
Sub Main()
Dim input AsString
Dim output AsNew StringBuilder()
Console.Write("Enter numbers: ")
input = Console.ReadLine()
For i As Integer = 0 To input.Length - 1
If output.ToString.Contains(input(i)) = False Then
output.Append(input(i))
EndIf
Next
Console.Write("The unique numbers are: ")
Console.WriteLine(output)
EndSub
EndModule
 
Back
Top