You are on page 1of 4

Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.

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

Private Sub ListView1_ColumnWidthChanging(sender As Object, e As ColumnWidthChan


gingEventArgs) Handles ListView1.ColumnWidthChanging
Dim DisableColumn As Integer = 0
If e.ColumnIndex = DisableColumn Then
e.Cancel = True
e.NewWidth = ListView1.Columns(DisableColumn).Width
End If
Dim DisableColumns As Integer() = {1, 2, 3, 4, 5, 6, 7}
For Each DCol As Integer In DisableColumns
If e.ColumnIndex = DCol Then
e.Cancel = True
e.NewWidth = ListView1.Columns(DCol).Width
End If
Next DCol
End Sub

Private Sub ListView1_ColumnClick(sender As Object, e As ColumnClickEventArgs)


Handles ListView1.ColumnClick
'Change this based on which direction you want
Dim blnAscending As Boolean = True
Me.ListView1.ListViewItemSorter = New ListViewItemComparer(e.Column, bln
Ascending)

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

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextB


ox1.TextChanged
If TextBox1.Text <> "" Then
ucitaj()
If ComboBox1.SelectedIndex = 0 Then
For Each Item As ListViewItem In ListView1.Items
If Not Item.SubItems(0).Text.Contains(TextBox1.Text) Then
Item.Remove()
End If
Next
ElseIf ComboBox1.SelectedIndex = 1 Then
For Each Item As ListViewItem In ListView1.Items
If Not Item.SubItems(1).Text.Contains(TextBox1.Text.ToUpper)
Then
Item.Remove()
End If
Next
End If
Else
ucitaj()
End If
End Sub

Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData A


s Keys) As Boolean
If keyData = Keys.Alt + Keys.P Then
MsgBox("OK", vbOK, "Obavestenje!")
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function

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)

If Char.IsDigit(e.KeyChar) Or Char.IsControl(e.KeyChar) Or (Asc(e.KeyChar) = As


c(".")) And RadTextBox1.Text.Count(Function(c As Char) c = ".") = 0 Then
e.Handled = False
Else
e.Handled = True
End If

RadTextBox4.Text = Format(Double.Parse(RadTextBox4.Text), "###,###,##0.00")

You might also like