- [DEVEXPRESS] Hướng dẫn bật tính năng Scroll Pixcel in Touch trên GridView
- [DEVEXPRESS] Hướng dẫn sử dụng TileBar viết ứng dụng duyệt hình ảnh Winform
- [DEVEXPRESS] Tô màu border TextEdit trên Winform
- [C#] Lấy dữ liệu từ Console Write hiển thị lên textbox Winform
- [C#] Hiển thị Progress bar trên Window Console
- [C#] Di chuyển control Runtime và lưu layout trên winform
- [SQLSERVER] Sử dụng hàm NULL IF
- [C#] Chia sẽ source code mã đi tuần bằng giao diện Winform
- [C#] Flash Window in Taskbar Winform
- Download và Giải nén tập tin File sử dụng Powershell
- [C#] Hướng dẫn cách lấy thông tin đăng nhập tài khoản và mật khẩu web browser trên windows
- [VB.NET] CRUD Thêm xóa sửa tìm kiếm Realtime FireBase
- [C#] Hiển thị thông báo Toast Message trong lập trình Winform
- [C#] Cấu hình định dạng ngày tháng, thời gian trên Windows cho ứng dụng Winform
- [C#] Rút gọn đường dẫn link url với TinyURL API
- [C#] Hướng dẫn cách bo tròn winform with Radius
- [C#] Chia sẽ class BackGroundOverlay Show Modal cho Winform
- [C#] Hướng dẫn Flip Image Winform
- [C#] Invoke là gì? cách sử dụng phương thức Invoke()
- [C#] Hướng dẫn chia sẽ file, folder từ ứng dụng sang Zalo Chat
[VB.NET] Viết ứng dụng chia sẽ mạng wifi internet trong LAN hotpost
Bài viết hôm nay, mình xin chia sẽ các bạn viết ứng dụng chia sẽ mạng internet. Ví dụ bạn có 1 sợi dây mạng sau đó cắm vào laptop và từ laptop phát wifi internet ra cho các máy bên ngoài sử dụng, như là phần mềm các bạn thường hay sử dụng là hostpost shield.
Thật ra, để tạo chia sẽ kết nối mạng từ Lan adapter qua wifi adapter, các bạn thể tìm trên mạng sẽ có hướng dẫn cách các bạn tạo hotspot bằng lệnh CMD trong MS-DOS.
Thì ứng dụng này mình viết dựa trên chạy những câu lệnh đó.
Giao diện ứng dụng:
Source code hotspot vb.net:
Public Class Form1
Private Sub LabelX1_Click(sender As Object, e As EventArgs) Handles LabelX1.Click
End
End Sub
Private Sub CheckBoxX1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxX1.CheckedChanged
If CheckBoxX1.CheckState = CheckState.Checked Then
TextBox2.UseSystemPasswordChar = False
End If
If CheckBoxX1.CheckState = CheckState.Unchecked Then
TextBox2.UseSystemPasswordChar = True
End If
End Sub
Private Sub ButtonX1_Click(sender As Object, e As EventArgs) Handles ButtonX1.Click
Try
If TextBox1.Text = "" Then
MsgBox("Hotspot name cant be empty", MsgBoxStyle.Critical)
End If
If TextBox2.TextLength < 8 Then
MsgBox("Password should be 8+ character", MsgBoxStyle.Critical)
If TextBox2.Text = "" Then
MsgBox("Password cant be empty", MsgBoxStyle.Critical)
End If
Else
Dim process As New Process()
process.StartInfo.Verb = "runas"
process.StartInfo.UseShellExecute = True
process.Start("cmd", String.Format("/c {0} & {1} & {2}", "netsh wlan set hostednetwork mode=allow ssid=" & TextBox1.Text & " key=" & TextBox2.Text, "netsh wlan start hostednetwork", "pause"))
MsgBox("Hotspot started Successfully", MsgBoxStyle.Information)
End If
Catch
MsgBox("Failed to Establish a hotspot", MsgBoxStyle.Exclamation)
End Try
End Sub
Private Sub ButtonX2_Click(sender As Object, e As EventArgs) Handles ButtonX2.Click
Process.Start("CMD", "/C netsh wlan stop hostednetwork")
MsgBox("Hotspot stoped Successfully", MsgBoxStyle.Information)
End Sub
Private Sub PanelEx1_Click(sender As Object, e As EventArgs) Handles PanelEx1.Click
End Sub
Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
Process.Start("CMD", "/C netsh wlan stop hostednetwork")
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class
HAVE FUN :)