1
General Programming / อยากวิธีทำ login web board [vb2008]
« เมื่อ: 22 เมษายน 2013, 22:24:21 » คืออยากวิธีทำ login web board ของSMF อะครับ ต้องทำไงดีครับเช่น login บอร์ดนี้ อะคับ
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
ผมมีโค้ดประมาณนี้ไม่รู้จะช่วยอะไรได้ไหมโค๊ด: [Select]Imports System.Text.RegularExpressions
'Example Dim x As String = RegexBetween("Tea", "go")
Private Function RegexBetween(ByVal sw As String, ByVal ew As String) As String
Dim s As String = "SomeText Tea ฟหกด Someone love one Someone love two but i love one go"
Dim r As New Regex(sw & "(.+?)" & ew)
Dim m As Match = r.Match(s)
If m.Success Then
Return m.Groups(1).ToString()
End If
Return "Not found"
End Function
โค๊ดนี้ใช้ได้แล้ว ..เพียงแต่คุณนำไปเขียนประยุกต์ใช้งานเพิ่มเติมก็เท่านั้น.
จริงๆแล้ว คำสั่งบางคำสั่งใน help ของ vb.net ไม่ได้ลงตัวอย่างไว้ให้ได้ศึกษา
ก็เลยไม่รู้ว่าใช้งานกันยังไง? มีประโยชน์อะไรบ้าง? ต้องศึกษา ค้นคว้า-ทดลอง เพิ่มเติมกันเอง.

Imports System.Text.RegularExpressions
'Example Dim x As String = RegexBetween("Tea", "go")
Private Function RegexBetween(ByVal sw As String, ByVal ew As String) As String
Dim s As String = "SomeText Tea ฟหกด Someone love one Someone love two but i love one go"
Dim r As New Regex(sw & "(.+?)" & ew)
Dim m As Match = r.Match(s)
If m.Success Then
Return m.Groups(1).ToString()
End If
Return "Not found"
End Function fjhfhuhfujhkjopiumkoiuyhhnl;
6523456d45g6d4fgh4df65h4js68r4h5sth4684dh65j4sth5rsth
sryhsth4654541545152451254sha65tg'jjlhj;dh8dryh
h45fh464654845674521546
164
Tea'thailand'go
dryhdhdghdfgl;ujhioh;odgjirg
gdfgdfgfhdfhdh205454dg4drgdr4g54545g
drgdfgdfg55155555555555
html5444545445
****************
link'487978eddf977887'go
fssdf####
อยากทราบวิธีCopy ข้อความ ที่อยู่ระว่าง link' และ 'go คือ 487978eddf977887 ซึ่งข้อความที่ต้องการCopy ที่ไม่ตายตัวครับและอยากให้ข้อความที่Copy มาปรากฏบน Textbox
Imports System.Windows.Forms
Imports AutoItX3Lib
Public Class Form1
Private oAutoIt As New AutoItX3
WithEvents button1 As New Button
WithEvents button2 As New Button
Private textbox1 As New TextBox
Private textbox2 As New TextBox
Private label1 As New Label
Private label2 As New Label
Private sfd As New SaveFileDialog
WithEvents time As New Timer
Private Sub time_TIck(ByVal sender As Object, ByVal e As EventArgs) Handles time.Tick
If oAutoIt.WinWait("Download File Info", "", 1) Then
textbox1.Text = oAutoIt.ControlGetText("Download File Info", "URL", "Edit3")
time.Enabled = False
button2.Enabled = True
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "IDM Download"
Me.Size = New Size(455, 145)
Me.CenterToScreen()
Me.MaximizeBox = False
button1.Text = "Start Download"
button1.SetBounds(153, 72, 153, 30)
button1.Cursor = Cursors.Hand
button1.Enabled = False
button2.Text = "..."
button2.SetBounds(404, 34, 28, 22)
button2.Enabled = False
textbox1.SetBounds(65, 9, 366, 20)
textbox2.SetBounds(65, 35, 335, 20)
label1.Text = "URL"
label1.Location = New Point(30, 12)
label2.Text = "Save As"
label2.Location = New Point(12, 35)
sfd.FileName = Nothing
sfd.Filter = "All Files(*.*)|*.*"
sfd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.Desktop
time.Enabled = True
time.Interval = 250
Me.Controls.AddRange(New Control() {button1, button2, textbox1, textbox2, label1, label2})
End Sub
Private Sub button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2.Click
sfd.FileName = My.Computer.FileSystem.GetName(TextBox1.Text)
If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
textbox2.Text = sfd.FileName
button1.Enabled = True
End If
End Sub
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
If TextBox1.Text <> String.Empty And TextBox2.Text <> String.Empty Then
button1.Text = "Downloading..Please wait!"
button1.Enabled = False
Try
My.Computer.Network.DownloadFile(TextBox1.Text, TextBox2.Text)
If My.Computer.FileSystem.FileExists(TextBox2.Text) Then
button1.Text = "Finish"
button1.Enabled = False
MsgBox("Download Completed", MsgBoxStyle.Information, "")
Me.Close()
End If
Catch
End Try
End If
End Sub
End Class
