0% found this document useful (0 votes)
43 views2 pages

Form1: "Unesite Broj Proizvoda:"

The document contains code for a form with buttons to manage an inventory list. Button1 allows the user to enter a number of products and input each product name. Button2 displays the list of products in a rich text box. Button3 searches the list for a product name and displays if found or not found. Button4 sorts the product list alphabetically and displays the sorted list.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views2 pages

Form1: "Unesite Broj Proizvoda:"

The document contains code for a form with buttons to manage an inventory list. Button1 allows the user to enter a number of products and input each product name. Button2 displays the list of products in a rich text box. Button3 searches the list for a product name and displays if found or not found. Button4 sorts the product list alphabetically and displays the sorted list.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Public Class Form1

Dim polje(75) As String


Dim N As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Try
N = InputBox("Unesite broj proizvoda:")
Dim i As Integer
For i = 1 To N
polje(i) = InputBox(" Unesite proizvod:( " & Str(i) & " )")
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
Dim i As Integer
For i = 1 To N
RichTextBox1.Text = RichTextBox1.Text & polje(i) & Chr(13)
Next
RichTextBox1.Text = RichTextBox1.Text & Chr(13)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Dim i As Integer
Dim niz As String
Dim pronaden As Boolean = False
niz = InputBox("Naziv proizvoda:")
For i = 1 To N
If polje(i) = niz Then
pronaden = 1
Exit For
End If
Next
If pronaden = True Then
MsgBox(niz & " Predmet je pronađen")
Else
MsgBox(niz & " Predmet nije pronađen")
End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button4.Click
Dim I, J As Integer
Dim Pom As String
For J = 1 To N - 1
For I = 1 To N - 1
If polje(I) > polje(I + 1) Then
Pom = polje(I)
polje(I) = polje(I + 1)
polje(I + 1) = Pom
End If
Next I
Next J
RichTextBox1.Text = RichTextBox1.Text & "Sortirani inventar:" & Chr(13)
For I = 1 To N
RichTextBox1.Text = RichTextBox1.Text & polje(I) & Chr(13)
Next

End Sub
End Class

https://files.fm/u/qtdgvp45

You might also like