Form1: "Unesite Broj Proizvoda:"

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 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