vb.net help me please

Q /
read words from the user and store it in array. It stops when the user enters "End". Concatenate the words together and print it in one line. The maximum length of array is 30.
----------------------------------------------------------------------------


I did it but , with a lot of error
help me please
Last edited on
How are you supposed to get the input - word by word in a loop or in one line?
What are your errors? Can you post the code?
Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim arr(30) As String
Dim line As String

For i As Integer = 0 To 30
arr(i) = InputBox(i)
Next

For i As Integer = 0 To 30
Label1.Text &= arr(i) & vbCrLf


Next

For i As Integer = 0 To 30
If (arr(i) = "End") Then

Next


End Sub
End Class
Try this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

  Dim Words(30) As String
  Dim WordCount As Integer = 0
  Dim Input As String = ""

  While (WordCount < 30 AndAlso Input <> "End")
    Input = InputBox("Enter Word " & CStr(WordCount), "Input")
    If Input = "End" Then
      Exit While
    Else
      Words(WordCount) = Input
      WordCount = WordCount + 1
    End If
  End While

  Label1.Text = String.Join(" ", Words, 0, WordCount)

End Sub
End Class
@Thomas1965
thank you so much


I have vb.net project


The project is the application of a cafe
We have 6 form
1 - Welcoming
2. Selection of drinks and cuisine
3. beverages
4. Food
5. Read the books and newspapers
6. contain Basket

how can I show the order in last form
for example:

3 cup of coffee
1 Donut

the total is : 20
What have you got so far?
how can i show the users purchases and the total


in last form I have to show the users purchases and the total

how can I do that ? please
how can i show the users purchases and the total
How are they declared?

How do you want to show them - Label, TextBox, MessageBox.....????????????????
show them in Label

Last edited on
Trim method in vb.net

my code :

Public Class Form1

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

Dim name As String

name = TextBox1.Text
Label2.Text = name.Trim & name


End Sub
End Class

--------------------------------------------
input: sa ra


output : sara sarasara sara

Thomas1965

show them in Label please;
Trim removes only leading and trailing spaces in a string. If you want to delete spaces in the middle you need to use the Remove function.
https://msdn.microsoft.com/en-us/library/system.string.remove%28v=vs.80%29.aspx
@Thomas1965


what about my vb.net project will you help me ?

in last form I have to show the users purchases and the sub total
in last form I have to show the users purchases and the sub total


Maybe sth. like that:
 
Label2.Text = "Purchases: " & Purchase.ToString() & vbCrLf & "Total: " & Total.ToString()
Topic archived. No new replies allowed.