'
' Created by SharpDevelop.
' User: Jano
' Date: 8.8.2017
' Time: 19:21
' 
' To change this template use Tools | Options | Coding | Edit Standard Headers.
'
Imports System.Text.RegularExpressions
Public Partial Class FNajdiRetazec
	Public Sub New()
		' The Me.InitializeComponent call is required for Windows Forms designer support.
		Me.InitializeComponent()
		
		'
		' TODO : Add constructor code after InitializeComponents
		'
	End Sub
	
	Sub Button1DragOver(sender As Object, e As DragEventArgs)
		toolTip1.SetToolTip(button1,"Kliknite sem pre vyhľadanie Vášho reťazca v Autoškole 7")		
	End Sub
	
	Sub FNajdiRetazecFormClosed(sender As Object, e As FormClosedEventArgs)
		MainForm.okno=0
	End Sub
	
	Sub Button1Click(sender As Object, e As EventArgs)
		'klikol vyhladat v Autoskole7
		If textBox1.Text.Trim()="" Then
			MsgBox("Musíte zadať hľadaný text!")
			Return
		Else
			'inak idem prehladat vsetky otazky na hladany textik
			Dim modul As New Module1
			'cohladam kdehladam vyjde false:
			'MsgBox(modul.najdeneCiNie("xxx","nsdfasdabcklsdfj"))
			Dim otazka As String = ""
			Dim nacitaj As String = ""
			Dim cinieco As Boolean = False
			For i As Integer = 1 To 36
				For j As Integer = 1 To 27
					otazka = otazka & "t" & i.ToString() & "o" & j.ToString()
					nacitaj=modul.citajOt(j,i)
					If modul.najdeneCiNie(textBox1.Text.Trim(),nacitaj) Then
						'ak som nasiel v danej otazke zhodu pridam ju do listboxu
						listBox1.Items.Add(otazka)
						cinieco = True
					End If
					otazka=""
				Next
			Next
			If cinieco=False Then
				MsgBox("Hľadané slovo sa nenašlo v celej Autoškole 7.")
			End If
			
		End If
	End Sub
	
	Sub Button1MouseHover(sender As Object, e As EventArgs)
		toolTip1.Show("Kliknite sem pre vyhľadanie Vášho reťazca v Autoškole 7", button1)	
	End Sub
	
	Sub ListBox1MouseDoubleClick(sender As Object, e As MouseEventArgs)
		'dvojklik na najdenu otazku
		'MsgBox(listBox1.SelectedItem)
	   	If listBox1.Items.Count = 0 Then
	   		Return
	   	Else
	   		'inak otvorim okno s rozkliknutou otazkou
	   		Dim o As New FVyuka(listBox1.SelectedItem,textBox1.Text.Trim())
	   		o.Show()
		End If
	      
	   
		
		
	End Sub
End Class
