Bylbym strasznie wdzieczny, gdyby ktos byl tak mily i pokazal mi jak zrobic cos takiego jak to w php:
Kod
Public Class Form1
Label1.Text = String.Empty
TextBox2.Clear()
If TextBox1.Text = "" Then
Label1.Text = "Nie mozesz nic nie wpisac..."
Exit Sub
End If
Dim file_num As Integer = FreeFile()
FileOpen(file_num, "ids.txt", OpenMode.Input, OpenAccess.Read, OpenShare.Shared)
Do While Not EOF(file_num)
Dim txt As String = LineInput(file_num)
If txt.Length > TextBox1.Text.Length Then
If txt.Substring(0, TextBox1.Text.Length) = TextBox1.Text Then
TextBox2.Text = txt.Substring(txt.Length - 5)
End If
If txt.Substring(txt.Length - 5) = TextBox1.Text Then
TextBox2.Text = txt.Substring(0, txt.Length - 7)
End If
End If
Loop
FileClose(file_num)
If TextBox2.Text = "" Then Label1.Text = "Wpisz cos..."
End Sub
TextBox1.Clear()
Label1.Text = String.Empty
End Sub
End Class
Label1.Text = String.Empty
TextBox2.Clear()
If TextBox1.Text = "" Then
Label1.Text = "Nie mozesz nic nie wpisac..."
Exit Sub
End If
Dim file_num As Integer = FreeFile()
FileOpen(file_num, "ids.txt", OpenMode.Input, OpenAccess.Read, OpenShare.Shared)
Do While Not EOF(file_num)
Dim txt As String = LineInput(file_num)
If txt.Length > TextBox1.Text.Length Then
If txt.Substring(0, TextBox1.Text.Length) = TextBox1.Text Then
TextBox2.Text = txt.Substring(txt.Length - 5)
End If
If txt.Substring(txt.Length - 5) = TextBox1.Text Then
TextBox2.Text = txt.Substring(0, txt.Length - 7)
End If
End If
Loop
FileClose(file_num)
If TextBox2.Text = "" Then Label1.Text = "Wpisz cos..."
End Sub
TextBox1.Clear()
Label1.Text = String.Empty
End Sub
End Class
Jak widzicie chodzi tutaj o prosta prace na tekscie, ktory sklada sie z wielu linijek ale jest ulozony tak:
xx xx(4 cyfry oddzielone spacja), y(tekst w roznych dlugosciach).
Chcialbym to samo zrobic w php. Zeby czytal ten tekst i zwracal mi, w zaleznosci od tego czy wpisze tekst czy te 4 cyfry, to drugie. Na przyklad wpisze cyfry, zwraca mi tekst itd.
2 okienka, jedno do wpisywanego tekstu, jedno do zwracanego. No i moze byc jeszcze przycisk potwierdzajacy wyslanie tekstu.
Z pewnoscia jest to tak latwe w php jak w c++, ale jestem kompletnie zielony jesli chodzi o pisanie w php i bylbym strasznie wdzieczny gdyby ktos mogl mi na szybko pomoc z tym.
Z gory dzieki, php'owy nowicjusz.