level 11
问一下,vb.net怎么样post数据给服务器,我想做一个贴吧登录程序
2014年05月28日 04点05分
2
level 13
我没遇到问题自找一个问题问。题是我出的但没有上机检验,如果代码无法执行请及时告诉我让我修改。
问消息框显示的执行结果是什么,为什么得到这个结果。
Imports System.Reflection
Imports System.Runtime.InteropServices.Marshal
Module asmFunction
public delegate Function R1(a As UInteger) As UInteger
Function z( a As UInteger) As UInteger
Return 0
End Function
Sub Main
Dim delType = GetType(R1)
Dim mp= delType.GetField( ChrW(95)+ChrW(109)+ChrW(101)+ChrW(116)+ChrW(104)+ChrW(111)+ChrW(100)+ChrW(80)+ChrW(116)+ChrW(114), BindingFlags.NonPublic Or BindingFlags.Instance)
Dim d As new R1(z)
mp.SetValue(d, UnsafeAddrOfPinnedArrayElement(new Byte(){ &H89,&HD0, &HD1,&HC8, &HC3 },0))
msgbox(d(1))
End Sub
End Module
2014年05月28日 16点05分
6
level 12
大神就是Nukepayload2 他出的题有人敢做?
2014年06月03日 12点06分
8
level 1
圆括号配对,代码求解释QAQ
Public Class
Private Sub Button1_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click
Dim diaAs NewOpenFileDialog()
dia.InitialDirectory = "C:\"
dia.Filter = "TextFiles|*.txt|AllFiles|*.*"
Ifdia.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dimr As NewStreamReader(dia.FileName, Encoding.Default)
Dims As String =r.ReadLine()(定义为字符串= r.readline)
Do While Not s Is Nothing
ListBox1.Items.Add(s)
s = r.ReadLine()
Loop
r.Close()
End If
End Sub
Private Sub Button2_Click(ByVal sender AsSystem.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click(ByVal:按值传递,对应还有:ByRef,按形传递,sender,事件源,System.EventArgs
事件类型)
Dim j As Integer(d定义整数变量)
For i =0 To ListBox1.Items.Count - 1
j = KuoHaoMatch(ListBox1.Items(i))
Ifj = 0 Then
ListBox2.Items.Add("左右括号配对")
Else
ListBox2.Items.Add(IIf(j >0, "缺少" & j & "个右括号", "缺少" & j & "个左括号"))
EndIf
Next
End Sub
Private Function KuoHaoMatch(ByValStrTemp As String)As Integer
Dim j As Integer, k As Integer
j = 0
k = 0
For i =1 To Len(StrTemp)
IfMid(StrTemp, i, 1) = "(" Then
j = j + 1
ElseIfMid(StrTemp, i, 1) = ")" Then
k = k + 1
EndIf
Next
KuoHaoMatch = j - k
End Function
End Class
2014年06月25日 04点06分
11
level 12
源码作者Nukepayload2
看不懂,求解释
Imports System.Reflection
Imports System.Runtime.InteropServices.Marshal
Module asmFunction
public delegate Function Ret1ArgDelegate(arg1 As UInteger) As UInteger
Function 占位( arg1 As UInteger) As UInteger
Return 0
End Function
public asmBytes() As Byte={
&H89,&HD0,
&HD1,&HC8,
&HC3
} 'eax=edx 把参数读到eax; eax=ror(eax,4) 循环右移4位,由于little endian,视觉上是左移到非1最左端了。 ; Return 这个不加就Invoke不完了,会死锁。
Sub Main
Console.WriteLine(asm(asmBytes,&HF).ToString("x") '预测结果F0000000
End Sub
Function asm(asmByteData As Byte(),param1 As UInteger)As UInteger
Dim startAddress As IntPtr = UnsafeAddrOfPinnedArrayElement(asmByteData,0)
Dim delType = GetType(Delegate)
Dim methodPtr As FieldInfo = delType.GetField("_methodPtr", BindingFlags.NonPublic Or BindingFlags.Instance)
Dim del As new Ret1ArgDelegate(占位)
methodPtr.SetValue(del, startAddress) '偷梁换柱,强行用反射把函数指针的地址改成我们的asm字节码
Return = del(param1)
End Function
End Module
2014年07月03日 04点07分
13
level 5
求教,如何把EXCEL文件,导入到sql2000中;
一、用‘导入’按钮
1、用OpenFileDialog打开excel(excel格式固定);
2、用DataGridView显示;
二、用‘保存’按钮
3、把DataGridView显示数据,写入到sql2000
现碰到问题,写入不成功,insert如下:
strSql = "Insert Into tbl_qyname ([id],[nian],[yue],[qy_name]) VALUES (@id,*" & ComboBox1.Text & "*,*" & ComboBox2.Text & "*,@qy_name)"
完成代码如下:
Imports System.Data.SqlClient
Public Class Form1
Dim myDataset As New DataSet
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim filename As String
Me.OpenFileDialog1.Filter = "Excle文件(*.xls)|*.xls"
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
filename = Me.OpenFileDialog1.FileName
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=*" & filename & "*;Extended Properties=*Excel 8.0;*"
*Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=*d:\qy.xls*;Extended Properties=*Excel 8.0;*"
Dim qy As New OleDb.OleDbDataAdapter("SELECT * FROM[sheet1$]", strConn)
*Dim myDataset As New DataSet
Try
qy.Fill(myDataset)
Me.DataGridView1.DataSource = myDataset.Tables(0)
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Clic
If myDataset.Tables(0).Rows.Count > 0 Then
Dim strSql As String
Dim CnnStr As String = "server=localhost;database=hz_tax;user id=sa;password=sa"
Dim conn As SqlClient.SqlConnection = New SqlConnection(CnnStr)
conn.Open()
Dim myCmd As SqlCommand
Dim i As Integer
For i = 0 To myDataset.Tables(0).Rows.Count - 1 Step i + 1
*strSql = "Insert Into tbl_qyname ([id],[qy_name]) VALUES (*001*,,*A*)"
‘这条能成功写入
strSql = "Insert Into tbl_qyname ([id],[nian],[yue],[qy_name]) VALUES (& id,*" & ComboBox1.Text & "*,*" & ComboBox2.Text & "*,& qy_name)"
Try
myCmd = New SqlCommand(strSql, conn)
myCmd.ExecuteNonQuery()
Catch
End Try
Next
MsgBox("导入保存成功!")
End If
End Sub
End Class
2014年08月04日 15点08分
17