Professional Documents
Culture Documents
Ke
yDown
If e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Tab Then
e.SuppressKeyPress = True
Me.SelectNextControl(Me.ActiveControl, True, True, True, True)
End If
End Sub
Public Sub ucitaj()
ListBox1.Items.Clear()
ListBox2.Items.Clear()
ComboBox1.Items.Clear()
con.Open()
cmd = New OleDbCommand("Select Korisnik, Lozinka from Korisnik", con)
dr = cmd.ExecuteReader()
If dr.HasRows Then
While (dr.Read())
ComboBox1.Items.Add(dr.Item("Korisnik").ToString)
ListBox1.Items.Add(dr.Item("Korisnik").ToString)
ListBox2.Items.Add(dr.Item("Lozinka").ToString)
End While
End If
dr.Close()
con.Close()
End Sub
End Sub
Class ListViewItemComparer
Implements IComparer
Private col As Integer
Private AscOrder As Boolean
Public Sub New()
col = 0
AscOrder = True
End Sub
Public Sub New(ByVal column As Integer, ByVal Ascending As Boolean)
col = column
AscOrder = Ascending
End Sub
Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer _
Implements IComparer.Compare
If AscOrder Then
Return [String].Compare(CType(x, ListViewItem).SubItems(col).Text, C
Type(y, ListViewItem).SubItems(col).Text)
Else
Return [String].Compare(CType(y, ListViewItem).SubItems(col).Text, C
Type(x, ListViewItem).SubItems(col).Text)
End If
End Function
End Class
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Han
dles ComboBox1.SelectedIndexChanged
If ComboBox1.Text <> "" Then
TextBox1.ReadOnly = False
End If
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Han
dles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedIndex <> -1 Then
ListBox1.SelectedIndex = ComboBox1.SelectedIndex
ListBox2.SelectedIndex = ListBox1.SelectedIndex
Else
ListBox1.SelectedIndex = ComboBox1.SelectedIndex
ListBox2.SelectedIndex = ListBox1.SelectedIndex
End If
End Sub
Dim br As Integer = 0
ucitaj1()
For Each item In ListBox1.Items
If item = MetroGrid1.CurrentCell.ToString Then
br = br + 1
End If
Next
If br = 0 Then
Dim asd As Integer
Int32.TryParse(MetroGrid1.CurrentCell.ToString, asd)
con.Open()
cmd = New OleDbCommand("Insert into RadnaGodina(TekucaGodina)values(
'" & asd & "')", con)
cmd.ExecuteNonQuery()
con.Close()
Else
End If
MetroTabControl1.TabPages.Remove(MetroTabPage4)
MetroTabControl1.TabPages.Insert(3, MetroTabPage4)