留存下模块代码,下次写代码就不用翻之前的代码了。模块代码: Module ini读写模块 Private Declare Unicode Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntW" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal nDefault As Integer, ByVal lpFileName As String) As Integer Private Declare Unicode Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringW" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As Strin
Me.DataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter For i As Integer = 0 To DataGridView1.Columns.Count - 1 Me.DataGridView1.Columns(i).SortMode = DataGridViewColumnSortMode.NotSortable Next
类文件[IPHelper.vb]: Imports System Imports System.Collections.Generic Imports System.IO Imports System.Linq Imports System.Net Imports System.Text Imports System.Threading.Tasks Namespace IPLibrary ''' <summary> ''' IP归属地查询 ''' qqwry.dat文件的结构原理参考:[qqwry.dat的数据结构图文解释](https://www.jb51.net/article/17197_all.htm) ''' </summary> Public Class IPHelper ' IP库文件地址 Private ReadOnly mLibraryFilePath As String ' 第一条索引的绝对地址 Private ReadOnly m
首先在Nuget中搜索JSON。然后下载Newtonsoft.Json.Linq然后使用下面的代码进行解析: ' 解析JSON数据 Dim jsonObject As JObject = JObject.Parse(responseContent) Dim code As String = jsonObject("code").ToString() If code = "1000" Then 全局变量_ip = jsonObject.SelectToken("data[0].ip").ToString() 全局变量_port = jsonObject.SelectToken("data[0].port").ToString() End If
取自程序的一段代码,放到博客,省得下次再找了。Dim rowIndex As Integer = DataGridView1.Rows.Add() With DataGridView1.Rows(rowIndex) .Cells(0).Value = rowIndex + 1 .Cells(1).Value = nickname .Cells(2).Value = unique_id .Cells(3).Value = following_count .Cells(6).Value = 待监控的粉丝数量 .Cells(8).Value = "基础数据已获取" .Cells(9).Value = id_str 'sec_uid End With DataGridView1.Refresh()
转换方式如下图:直接GET请求下抖音分享链接即可。注意:需要禁止重定向。在返回的内容处,可以获取用户的sec_uid(MS开头)VB.NET 实现代码:Imports System.Net Imports System.Text.RegularExpressions Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim request As HttpWebRequest = DirectCast(WebRequest.Create(TextBox1.Text), HttpWebRequest) request.AllowAutoRedirect = False Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse) Dim responseStrea
水一篇文章啦,今天给别人写程序遇到的一个。感觉下面的代码挺不错的,能实现向远程服务器上传文件。Dim ftpServer As String = "ftp://1.1.1.1:21/" Dim ftpUsername As String = 账号 Dim ftpPassword As String = 密码 Dim localFilePath As String = "1.jpg" '本地目录 Dim remoteFilePath As String = TextBox7.Text & "合成_" & 全局变量_当前命名 & ".jpg" ' 需要上传的目录 Dim request As FtpWebRequest = DirectCast(WebRequest.Create(ftpServer + remoteFilePath), FtpWebRequest) request.Metho
Imports System.Runtime.InteropServices Public Class Form1<DllImport("user32.dll")> Private Shared Function RegisterHotKey(ByVal hWnd As IntPtr, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) As Boolean End Function <DllImport("user32.dll")> Private Shared Function UnregisterHotKey(ByVal hWnd As IntPtr, ByVal id As Integer) As Boolean End Function ' 窗体句柄 Private hwnd As IntPtr ' 热键标识符 Private Const HOTKEY_ID As Integer = 1 ' 注册热键 Private
Public Sub 延时秒(ByVal 延时 As Integer, Optional ByVal 单位 As String = "毫秒") Dim 延时时间 As Int64 '因为时间是以100纳秒为单位。 If 单位 = "毫秒" Then 延时时间 = 延时 * 10000 If 单位 = "秒" Then 延时时间 = 延时 * 10000 * 1000 If 单位 = "分" Then 延时时间 = 延时 * 10000 * 1000 * 60 If 单位 = "时" Then 延时时间 = 延时 * 10000 * 1000 * 60 * 60 If 单位 = "天" Then 延时时间 = 延时 * 10000 * 1000 * 60 * 60 * 24 Dim 临时时间 As DateTime = DateTime.Now Whil
Imports System.Windows.AutomationImports System.Runtime.InteropServicesPublic Class Form1<DllImport("user32.dll", SetLastError:=True)> Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click GetChatWndElements() End Sub Public Sub GetChatWndElements() ' 根据快速窗口类名查找窗口 Dim text As String Dim condition As Condition = New Proper
LaoDan
鱼头网络工作室