下面c#代码怎么转成vb.net? [问题点数:20分]

Bbs1
本版专家分:0
结帖率 50%
Bbs1
本版专家分:88
Bbs5
本版专家分:4771
Blank
红花 2015年7月 Windows专区大版内专家分月排行榜第一
vb.net代码转成c#代码
我下了几个工具都不太好用,哪为兄弟知道还有什么好的工具,<em>怎么</em>样用,告诉小弟,谢谢
请问这段C#代码怎么转成vb.net
[code=C#] public delegate void OnGetEventTypesDelegate(GetEventTypesResp resp, GetEventTypesTask.eventTypesEnum taskType);rn public static event OnGetEventTypesDelegate OnGetEventTypes;[/code]rn后面有[code=C#] if (OnGetEventTypes != null)rn rn OnGetEventTypes(resp, m_taskType);rn [/code]rn能触发rnprivate void GetEventTypesTask_OnGetEventTypes(GetEventTypesResp resp, GetEventTypesTask.eventTypesEnum taskTypeEnum)rnrn但是我<em>转成</em><em>vb.net</em>后<em>怎么</em>也不能触发事件,<em>怎么</em>问<em>怎么</em>添加那个事件?rn这是我转换后的<em>代码</em>:rn[code=VB.NET] Public Delegate Sub OnGetEventTypesDelegate(ByVal resp As GetEventTypesResp, ByVal taskType As GetEventTypesTask.eventTypesEnum)rn Public Shared Event OnGetEventTypes As OnGetEventTypesDelegate[/code]rn[code=VB.NET] RaiseEvent OnGetEventTypes(resp, m_taskType)[/code]rn[code=VB.NET]Private Sub GetEventsTask_OnGetEvents(ByVal resp As GetEventsResp, ByVal node As TreeNode, ByVal marketId As Integer)[/code]
C# TreeView代码转成 VB.NET的
这是我以前程序里用的到TreeViewrn但我有个朋友现在要VB.NET的,我给他这个,他不会转。rn第一个绑定类型他搞定了,但绑定品牌要传个节点参数,但他写的总报错rn谁能帮我转换下,VB.NET我只能教他思路,源码我也不会换rn[code=C#]rn#region[绑定TV_Product数据]rn /// rn /// 绑定TV_Product数据rn /// rn public void bindToTV_Product()rn rn if (TV_Product.Nodes.Count < 1)rn rn mytable = _product.QueryBS_Category();rn for (int i = 0; i < mytable.Rows.Count; i++)rn rn TreeNode node = new TreeNode(mytable.Rows[i]["CName"].ToString().Trim().ToString(),rn mytable.Rows[i]["CNID"].ToString().Trim().ToString(), "Images/4.gif");rn TV_Product.Nodes.Add(node);rn bindToBra_NID(_product.Query_Brand(TV_Product.Nodes[i].Value), TV_Product.Nodes[i]);rn rn rn rn #endregionrnrn#region[根据类别绑定品牌信息]rn /// rn /// 根据类别绑定品牌信息rn /// rn /// 品牌信息rn /// 树节点rn public void bindToBra_NID(DataTable table, TreeNode tvnode)rn rn for (int i = 0; i < table.Rows.Count; i++)rn rn TreeNode node = new TreeNode(table.Rows[i]["CName"].ToString().Trim().ToString(),rn table.Rows[i]["CNid"].ToString().Trim().ToString(), "Images/17.gif");rn tvnode.ChildNodes.Add(node);rn bindToBreed(_product.Query_Breed(tvnode.ChildNodes[i].Value), tvnode.ChildNodes[i]);rn rn tvnode.Collapse();rn rn #endregionrnrn #region[根据品牌绑定品名信息]rn /// rn /// 根据品牌绑定品名信息rn /// rn /// 品名信息rn /// 树节点rn public void bindToBreed(DataTable table, TreeNode tvnode)rn rn for (int i = 0; i < table.Rows.Count; i++)rn rn TreeNode node = new TreeNode(table.Rows[i]["CName"].ToString().Trim().ToString(),rn table.Rows[i]["CNid"].ToString().Trim().ToString(), "Images/wi.gif");rn tvnode.ChildNodes.Add(node);rn rn tvnode.Collapse();rn rn #endregionrn[/code]
请将下面C#代码转成C++代码
[code=C#]using System;rnusing System.Collections.Generic;rnusing System.Text;rnusing System.IO;rnrnnamespace BubbleSortrnrn class Programrn rn static void Main(string[] args)rn string s = "";rnusing (StreamReader sr = new StreamReader(@"d:\file.txt"))rnrn s = sr.ReadToEnd();rn sr.Close();rnrnstring[] array = s.Split(new char[] '\r', '\n' , StringSplitOptions.RemoveEmptyEntries);rnSortedList list = new SortedList();rnfor (int i = 0; i < array.GetLength(0); i++)rnrn if (!list.ContainsKey(Convert.ToInt32(array[i])))rn rn list.Add(Convert.ToInt32(array[i]), Convert.ToInt32(array[i]));rn rnrnConsole.WriteLine("排序前");rnfor (int i = 0; i < array.GetLength(0); i++)rn Console.WriteLine(array[i]);rnConsole.WriteLine("排序后");rnfor (int i = 0; i < list.Count; i++)rn Console.WriteLine(list.Keys[i]); rnrnrn rn rn[/code]
如何将这句vb.net代码转成C#代码
ElseIf ((CShort(-((buffer(0) = &H80) > False)) Or (buffer(0) And 0)) > 0) Thenrnrn看不明白这句话
以下vb.net代码如何转成c#代码
dim i as integerrndim s as stringrnrni = asc("汉")rni = ascw("汉")rns = chr(37010)rns = chrw(-9301)
请问有没有把VB.NET代码转成C#代码的工具?如果没有,下面代码怎么转?
有没有把VB.NET<em>代码</em><em>转成</em>C#<em>代码</em>的工具呢?rnrn如果没有的话,<em>下面</em>的VB.NET<em>代码</em>改成C#后应该为怎样?rn请熟悉的高手写一下,我会通过这样的例子举一反三,把其它的VB.NET<em>代码</em>都转C#的。rnrnOption Strict OnrnOption Explicit On rnrnImports Systemrnrn _rnPublic Class WebChartItemCollection : Inherits System.Collections.CollectionBasern Private mOwner As WebChartrn Public Sub New()rn MyBase.New()rn End Subrnrn Public Sub New(ByVal Owner As WebChart)rn MyBase.New()rn mOwner = Ownerrn End Subrnrn Private Property Owner() As WebChartrn Getrn Return CType(mOwner, WebChart)rn End Getrn Set(ByVal Value As WebChart)rn mOwner = Valuern End Setrn End Propertyrnrn Default Public ReadOnly Property Item(ByVal index As Int32) As WebChartItemrn Getrn Return CType(List.Item(index), WebChartItem)rn End Getrn End Propertyrnrn Public Function Add(ByVal Item As WebChartItem) As Integerrn Return List.Add(Item)rn End FunctionrnrnEnd Classrnrn
怎么下面这段vb.net代码,转变成c# 代码
Option Strict OffrnOption Explicit On rnPublic Class Form1rn Inherits System.Windows.Forms.Formrnrnrn Private Declare Function Reset Lib "D:\App\Working\hhh\fr606.dll" () As Integerrn Private Declare Function OpenCom Lib "D:\App\Working\hhh\fr606.dll" (ByVal ComPort As String, ByVal Baud As Integer) As Integerrn Private Declare Function CloseCom Lib "D:\App\Working\hhh\fr606.dll" () As Integerrn Private Declare Function ReadData Lib "D:\App\Working\hhh\fr606.dll" (ByVal Track2 As String, ByVal Track3 As String, ByVal inTrack As Integer) As Integerrn Private Declare Function WriteData Lib "D:\App\Working\hhh\fr606.dll" (ByVal Track2 As String, ByVal Track3 As String, ByVal inTrack As Integer) As Integerrnrnrnrnrn Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clickrn Dim rtn As Integerrn Dim strCom As Stringrnrn If _optCom_0.Checked = True Thenrn strCom = "COM1"rn Elsern strCom = "COM2"rn End Ifrnrn rtn = OpenCom(strCom, 9600)rn If rtn <> 0 Thenrn MsgBox(" Open OK", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Magcard Test")rn Elsern MsgBox("Open Failure", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Magcard Test")rn End Ifrn End Subrnrn Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Clickrn Dim rtn As Integerrn Dim strTr2Str As Stringrn Dim strTr3Str As Stringrnrn strTr2Str = New String(vbNullChar, 255)rn strTr3Str = New String(vbNullChar, 255)rn Text1.Text = ""rn Text2.Text = ""rn rtn = ReadData(strTr2Str, strTr3Str, 23)rnrn If rtn = 0 Thenrn Text1.SelectedText = strTr2Strrn Text2.SelectedText = strTr3Strrnrn Elsern MsgBox("Reset Failure", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Magcard Test")rn End Ifrn rn End Sub
帮助将下面代码转成C#
DELPHI 的rnrn[code=delphi]PT_AIScale = Recordrn reading : Smallint;rn MaxVolt : Single;rn MaxCount : Smallint;rn offset : Smallint;rn voltage : ^Single; Float far *Voltage rn End;[/code]rnrnCrn[code=c]typedef struct tagPT_AIScalernrn USHORT reading;rn FLOAT MaxVolt;rn USHORT MaxCount;rn USHORT offset;rn FLOAT far *voltage;rn PT_AIScale, FAR * LPT_AIScale;[/code]
VB.Net转成C#
Protected Sub LBView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LBView1.Click rnMe.MultiView1.ActiveViewIndex = 0rnCell1.Attributes("class") = "SelectedTopBorder"rnCell2.Attributes("class") = "TopBorder"rnCell3.Attributes("class") = "TopBorder"rnrnDim alParams As System.Collections.ArrayList = New System.Collections.ArrayList()rnalParams.Add("au_lname")rnalParams.Add("au_fname")rnalParams.Add("address")rnMe.GridView1.DataSource = ReturnDataSet("authors", alParams)rnMe.GridView1.DataBind()rnEnd Subrn rn<em>转成</em>C#应如何改?thks.rn
C#转成VB.NET
[code=C#]rn public class MarkAsCompleteTotalCostsrn rnrn private decimal _Actual;rn public decimal Actualrn rn get return _Actual; rn set _Actual = value; rn rnrn private decimal _Planned;rn public decimal Plannedrn rn get return _Planned; rn set _Planned = value; rn rnrn public MarkAsCompleteTotalCosts(decimal _Actual, decimal _Planned)rn rn this._Actual = _Actual;rn this._Planned = _Planned;rn rnrn public List ConvertToSource()rn rn return new List() this ;rn rn rn[/code]rnrn这里rn[code=C#]rn public List ConvertToSource()rn rn return new List() this ;rn rn[/code]rn该<em>怎么</em>改。。。rn[code=VB.NET]rn Public Function ConvertToSource() As List(Of MarkAsCompleteTotalCosts) rn Return New List(Of MarkAsCompleteTotalCosts)() ' ...rn End Function rn[/code]rnrn
帮忙, vb.net 转成 C#
Dim arrLst As New ArrayList()rnDim strFinal As StringrnDim strarr() As StringrnrnarrLst.Add("aaa@aaa.com")rnarrLst.Add("bbb@bbb.com")rnarrLst.Add("ccc@ccc.com")rnrnstrarr = arrLst.ToArray(Type.GetType("System.String"))rnstrFinal = String.Join(",", strarr)rnMessageBox.Show(strFinal)rnrn
c#转成vb.net
我想实现:把一条C#语句<em>转成</em><em>vb.net</em>rn object[] atts=(object[])blkref.getattributes(); //cad开发中获取块参照中的属性rn
c#转成vb.net的问题
C#内容:rnprivate string XXX= "a";rnPublic Property XXX() As Stringrn Getrn Return XXXrn End Getrn Set(ByVal value As String)rn XXX= valuern End Setrn End Propertyrn<em>转成</em>vb<em>怎么</em>转,谢谢。rn
c#转成VB.net
rnrn<em>c#</em>可以这样Container.DataItem as System.Data.DataRow写,rn不知道<em>vb.net</em>应该<em>怎么</em>写,各位高手帮个忙,不会的也帮我项一下。谢谢!
一段C#代码,能不能帮忙转成VB.NET的?
[code=csharp]using System;rnusing System.Collections.Generic;rnusing System.Text;rnrnnamespace ImpjCRC16rnrn public static class Crc16rn rn static readonly ushort[] crc_ta =rn /* CRC余式表 */rn 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,rn 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,rn 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,rn 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,rn 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,rn 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,rn 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,rn 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,rn 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,rn 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,rn 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,rn 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,rn 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,rn 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,rn 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,rn 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,rn 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,rn 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,rn 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,rn 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,rn 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,rn 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,rn 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,rn 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,rn 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,rn 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,rn 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,rn 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,rn 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,rn 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,rn 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,rn 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040rn ;rnrnrnrn public static UInt16 CRC16(byte[] dataIn, int length)rn rn UInt16 result = 0;rn UInt16 tableNo = 0;rnrn for (int i = 0; i < length; i++)rn rn tableNo = (UInt16)((result & 0xff) ^ (dataIn[i] & 0xff));rn result = (UInt16)(((result >> 8) & 0xff) ^ crc_ta[tableNo]);rn rn return result;rn rnrn rnrnrn //<em>c#</em>调用上面的函数调用rn private void button1_Click(object sender, EventArgs e)rn rn UInt16 crc = 0;rn byte[] Data = new byte[4];rn Data[0] = 0x01;rn Data[1] = 0x02;rn Data[2] = 0x03;rn Data[3] = 0x04;rn UInt16 crc = CRC16( Data,4);rnrn byte[] r= UInt16tobyte(crc);rnrn MessageBox.Show(string.Format(" 0:X2", r[1]) + " " + string.Format(" 0:X2", r[0]));rnrn rnrnrn /// rn /// UInt16 转 字节数组rn /// rn /// rn /// rn public static byte[] UInt16tobyte(UInt16 X)rn rn byte[] bytearr = new byte[2];rn bytearr[0] = (byte)(X >> 8);rn bytearr[1] = (byte)(X);rn return bytearr;rn [/code]
这段vb.net代码如何转成C#?
dim DvEmployees as new DataView()rnrn...rnrnDvEmployees(0).Item("firstname")="aa"rnrnrn谢谢!!!
vb代码怎么转成C#的
VB<em>代码</em>中 Dim a() As Byte 是什么意思,是定义个byte数组还是只是定义了一个byte类型的rn在C#中<em>怎么</em>定义这样的变量呢?rn求高手解答下,谢谢!!
vb的代码怎么转成c#
vb的<em>代码</em><em>怎么</em><em>转成</em><em>c#</em>的rnrnrnrnrn rnrnrn TreeViewSelectedIndexChanged.aspxrnrn rnrnrnrnrnrn rnrn rnrnrnrnrnrn rnrnrnrnrnrnrnrn rnrn这样改了不可以。rnrn谢谢!rnrn
求助,下面这段易语言代码转成C#该怎么
.子程序 ComputeOfficial, 文本型, rn.参数 ranKey, 字节集rn.参数 tgtgt_fix, 字节集rn.参数 tgtgtKey, 字节集rn.局部变量 keyMd5, 字节集rn.局部变量 sigPicMd5, 字节集rn.局部变量 newMd5, 字节集rn.局部变量 tgtgtMd5, 字节集rn.局部变量 totalMd5, 字节集rn.局部变量 tmpMd5, 字节集rn.局部变量 loopMd5, 字节集rn.局部变量 i, 整数型rn.局部变量 result, 字节集rn.局部变量 tmpD0, 整数型rn.局部变量 tindex, 整数型rn.局部变量 _key, 字节集rn.局部变量 preBytes, 文本型rn.局部变量 backBytes, 字节集rn.局部变量 pack, Packetrn.局部变量 computeKey, 字节集rn.局部变量 tmpD4, 整数型rn.局部变量 backBytes_str, 文本型rnrnkeyMd5 = 取空白字节集 (16)rnsigPicMd5 = 取空白字节集 (16)rnnewMd5 = 取空白字节集 (16)rntgtgtMd5 = 取空白字节集 (16)rntotalMd5 = 取空白字节集 (64)rntmpMd5 = 取空白字节集 (16)rnloopMd5 = 取空白字节集 (16)rnresult = 取空白字节集 (16)rn_key = 取空白字节集 (16)rn' preBytes = 取空白字节集 (16)rnbackBytes = 取空白字节集 (8)rncomputeKey = 取空白字节集 (128)rnkeyMd5 = Md5_ (ranKey)rnsigPicMd5 = Md5_ (tgtgt_fix)rnnewMd5 = ComputeNewKey (sigPicMd5, keyMd5)rntgtgtMd5 = Md5_ (tgtgtKey)rnCopyTo (keyMd5, totalMd5, 0)rnCopyTo (sigPicMd5, totalMd5, 16)rnCopyTo (newMd5, totalMd5, 32)rnCopyTo (tgtgtMd5, totalMd5, 48)rntmpMd5 = Md5_ (totalMd5)rnCopyTo (tmpMd5, loopMd5, 0)rn.计次循环首 (10, i)rn loopMd5 = Md5_ (loopMd5)rn.计次循环尾 ()rnCopyTo (loopMd5, totalMd5, 0)rn.计次循环首 (4, tmpD0)rn tindex = (tmpD0 - 1) × 16rn Copy (totalMd5, tindex, _key, 0, 16)rn preBytes = TeaEncrypt (BytesToHex (tmpMd5), BytesToHex (_key))rn Copy (tmpMd5, 8, backBytes, 0, 8)rn backBytes_str = TeaEncrypt (BytesToHex (backBytes), BytesToHex (_key))rn pack.PutBytes (preBytes)rn pack.PutBytes (backBytes_str)rn computeKey = HexToBytes (pack.GetPacket ())rn tmpD4 = tmpD0rn .判断循环首 (tmpD4 ≤ 16)rn result [tmpD4] = 到字节 (位异或 (result [tmpD4], computeKey [tmpD4]))rn tmpD4 = tmpD4 + 1rn .判断循环尾 ()rn.计次循环尾 ()rnresult = Md5_ (result)rn' 信息框 (BytesToHex (result), 0, , )rn返回 (BytesToHex (result))rn
把这句c#转成vb.net怎么写?
不知<em>怎么</em>写rnthis.Invoke(new Action(() => textbox1.Text = "ads"))
这句C#转成vb.net怎么
AddMessageEventListener("callMe", ((string p) => callMe(p); ));rn主要是后面这个((string p) => callMe(p); ),可以写成:rnDim myaction New Action (Of String) =sub callMe(p as String) rnmsgbox (s) rnEnd rnAddMessageEventListener("callMe", myaction)
请教下 c#/vb.net 怎么转成机器语言的
是不是按这个顺序转的:rnrn<em>c#</em>通过clr<em>转成</em>cil,cil通过jit即时编译器<em>转成</em>汇编语言,然后通过汇编编译器<em>转成</em>机器码的? 还是不需要<em>转成</em>汇编就直接到机器码?rnrn谢谢
这句Vb.net转成c#怎么写?
Dim WithEvents daServerMgt As New Kepware.ClientAce.OpcDaClient.DaServerMgtrnKepware.ClientAce.OpcDaClient.DaServerMg是一个类rn
这段vb6代码怎么转成vb.net
[code=VB]Dim mCnn As New ADODB.ConnectionrnDim mRs As ADODB.RecordsetrnDim strSql As StringrnDim mExcelFile As ObjectrnPrivate Sub Form_Load()rnrnrn mCnn.Open ("Driver=SQL Server;Server=RD2YIQI2;DataBase=threedata;UID=sa;WD=;")rnrnrnstrSql = "select * from table_clcl"rnSet mRs = New ADODB.RecordsetrnmRs.Open strSql, mCnn, adOpenKeyset, adLockReadOnlyrnIf mRs.RecordCount > 0 Thenrn Set mExcelFile = CreateObject("Excel.Sheet")rn mExcelFile.Application.Range("A1").CopyFromRecordset mRsrn mExcelFile.SaveAs "c:\123.xls"rn mExcelFile.Application.quitrn Set mExcelFile = NothingrnEnd IfrnIf mRs.State = adStateOpen Then mRs.Close: Set mRs = NothingrnrnEnd Sub[/code]rnrn这段<em>代码</em>在vb6里面运行通过,<em>转成</em><em>vb.net</em><em>代码</em>是<em>怎么</em>样的?
这段vb.net代码怎么转成asp.net
rnrn rnrnrn大家快来帮我啊,急呢
请问下面这段c#代码vb.net怎么写?
internal class DataGridNoActiveCellColumn : System.Windows.Forms.DataGridTextBoxColumnrn rn //重载DataGridTextBoxColumn类的Edit方法,以便使点击DataGrid中任一单元格都选中当前行rn protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)rn rn int SelectedRow = rowNum;rn this.DataGridTableStyle.DataGrid.Select(SelectedRow);rn rnrn
怎么将VB6 开发的源程序,转成C# 代码,中间 是不是要先转成VB.NET的代码
<em>怎么</em>将VB6 开发的源程序,<em>转成</em>C# <em>代码</em>,中间 是不是要先<em>转成</em>VB.NET的<em>代码</em>,而后再<em>转成</em>C#的<em>代码</em>?
下面这个函数如何转成VB.NET的啊
function getcardinfo(mycard:pchar;rdlen:longint):pointer;rnbeginrn if mycard<>nil thenrn move(cardbuf,mycard,rdlen);rn result:=@cardbuf;rnend;rn
c#语句转vb.net,这两句要怎么转成 VB.NET
'' :THIS怎样写成VB.NET的函数形式rnpublic ExRichTextBox(RtfColor _textColor, RtfColor _highlightColor) : this() rn textColor = _textColor;rn highlightColor = _highlightColor;rn rn'':base怎样写成VB.NET的函数形式rnpublic ExRichTextBox() : base() rn...................rn
高分求下面asp代码转成c#代码。谢谢了
sql="select * from article where (articleid is null)" rn rs.open sql,conn,1,3rn rs.addnewrn rs("title")=titlern rs("content")=contentrn rs("dateandtime")=date()rn rs.updatern articleid=rs("articleid")rn
帮忙vb.net转成c#,谢谢
Dim myDeleteButton As ImageButton = CType(e.Item.FindControl("Delete"), ImageButton)rnrn我转的是rnButton myDeleteButton =new CType(e.Item.FindControl("Delete"),Button);rnrn因为我用的是button所以<em>转成</em>那了.可是提示找不到类型或命名空间名称“CType”(是否缺少 using 指令或程序集引用?)
这段c#如何转成vb.net
[code=csharp]rnnew Action(async () =>rn rn await Delay3000Async();rn await Delay2000Async();rn await Delay1000Async();rn )(); rn[/code]rnrn<em>转成</em><em>vb.net</em>的话貌似必须rndim a as new Action()rn。。。rn觉得有点麻烦,如何直接转rn
将一条VB.NET转成C#
请问各位AddHandler PrintDocument1.PrintPage,AddressOf PrintDocument1_PrintPage<em>转成</em>C#应该怎样写呢?rn<em>下面</em>这句是我改的,但提示不对;rnPrintDocument1.PrintPage += new EventHandler(printDocument1_PrintPage); rn提示:"printDocument1_PrintPage"的重载均与委托"System.EventHandler"不匹配rn
求高手,如何将下面C语言代码转成C#的代码
这是一个往另一台机器上发送指令的函数,所以用到TCP,我有协议,但是不会组包发送 请高手<em>代码</em>提示用C#的rntypedef structrnrnunsigned short m_nCommand;//命令字rnunsigned long m_nDataLen;//数据段长度rnPACKAGE_HEAD;rn[color=#FF0000]//所有命令都采用[包头]+[数据段]的方式来构造网络包。[/color]rn//3.数据段格式定义rn//-----------------------------------------------rn//传输所用的端口rn//-----------------------------------------------rn/*#define COMMUNICATIONPORTrn#define UDP_SEND_PORT 9898rn9897 *///板子端 TCP、UDP 监听端口rn//控制端监听 UDP 端口rn#define SC_GET_SYS_INFO 0x1000//获取 Sigma 板子信息、系统运行状态rn//PC 发送的数据段:无rn//Sigma 反馈数据: BSQ_ADVERTISE_INFO (数据结构请参考之后的说明,下同)rn#define SC_GET_LOG0 x1001//PC 获取每个板子播放统计 logrn//PC 发送的数据段:无rn//Sigma 反馈数据:Sigma 上传到 PC 上一个文件,以 ip 命令的日记文件。rn#define SC_FTP_DOWN_STATUS 0x1002 //询问 Sigma 板子下载进度rnrnrnchar tmp[1024];rn int len;rn memset(tmp,0,sizeof(tmp));rnrnQByteArray globalSendData;rnQDataStream out(&globalSendData,QIODevice::WriteOnly);rnout.setVersion(QDataStream::Qt_4_6);rnout.setByteOrder(QDataStream::BigEndian);rnrn QString plaintext = ui->textEditInsert->toPlainText();rnrnlen = sizeof(tmp) > plaintext.toUtf8().size() ? plaintext.toUtf8().size() : sizeof(tmp);rn qDebug() << "size" << len << plaintext;rn memcpy(tmp,plaintext.toUtf8().data(),len);rnrn out << quint16(SC_INSERT_TXT) << quint32(sizeof(BSQ_INSERT_TXT));rn out << qint8(ui->comboBoxTxtPlace->currentIndex())rn << qint8(ui->comboBoxTxtType->currentIndex())rn << qint8(ui->comboBoxTxtRow->currentIndex())rn << qint8(ui->comboBoxTxtVoice->currentIndex());rn out.writeRawData(tmp,sizeof(tmp));rn globalSendData.resize(sizeof(PACKET_HEAD) + sizeof(BSQ_INSERT_TXT));
VB.NET的select语句转成C#
Select Number rn Case 1 To 5 rn Debug.WriteLine("Between 1 and 5")rnEnd Selectrn用C#<em>怎么</em>写?谢谢
这句vb.net的如何转成C#?
If li.rs.Tables("soft").Rows.Count Mod PageSize = 0 Thenrn换成C#<em>怎么</em>写?mod运算符在C#用什么表示?
把C++代码转成vb.net
[img=https://img-bbs.csdn.net/upload/201704/27/1493275047_236819.png][/img]rn[img=https://img-bbs.csdn.net/upload/201704/27/1493275036_71081.png][/img]rnrn谁能帮忙把这段<em>代码</em>改成<em>vb.net</em>的 rnrnrn谢谢
一行代码如何转成VB.net
(axWb.Document as UnsafeNativeMethods.IPersistStreamInit).Load(new UnsafeNativeMethods.ComStreamFromDataStream(dataStream));
这段代码如何转成vb.net
[code=csharp]rnpublic unsafe static Mat ConvolutionImage(Mat img, double[,] k, int offsetH, int offsetW, int height, int width)rn rn Mat src = new Mat(img, new Rect(offsetW, offsetH, width, height));rn Mat dst = new Mat(src.Size(), MatType.CV_8UC1, new Scalar(0));rn int rows = src.Height, cols = src.Width;rn int v;rn for(int i = 1; i < rows -1; i++)rn rn IntPtr a = dst.Ptr(i);rn byte* b = (byte*)a.ToPointer();rn for (int j = 1; j < cols - 1; j++)rn rn b[j] = 200;rnrn rn rn return dst;rn rn[/code]rnrn就是 opencvSharp 快速遍历Mat像素点
C#代码转成VB.Net代码。。。麻烦各位兄弟了。。
public partial class Form1 : Formrn rn public Form1()rn rn InitializeComponent();rnrn dataGridView1.Columns.Add("a", "a");rn dataGridView1.Rows.Add(new object[] 1 );rnrn dataGridView1.EditingControlShowing +=new DataGridViewEditingControlShowingEventHandler(dataGridView1_EditingControlShowing);rn rnrn private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)rn rn if (e.Control is TextBox)rn rn TextBox tb = (TextBox)e.Control;rn tb.KeyUp += new KeyEventHandler(tb_KeyUp);rn rn rnrn void tb_KeyUp(object sender, KeyEventArgs e)rn rn if (e.KeyCode == Keys.F3)rn rn Form form = new Form();rn form.ShowDialog();rn rn rn rnrn谁能帮忙吧这个C#<em>代码</em><em>转成</em>VB.NET的啊?rnrn原帖在这里:rnhttp://topic.csdn.net/u/20081111/13/244cb63d-8a99-41fb-90a0-2b3fb71f0912.htmlrnrn我用<em>代码</em>转换的工具<em>转成</em>VB.NET的,可是却报错。。rnrnPublic Partial Class Form1rn Inherits Formrn Public Sub New()rn InitializeComponent()rnrn dataGridView1.Columns.Add("a", "a")rn dataGridView1.Rows.Add(New Object() 1)rnrn dataGridView1.EditingControlShowing += New DataGridViewEditingControlShowingEventHandler(AddressOf dataGridView1_EditingControlShowing)rn End Subrnrn Private Sub dataGridView1_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs)rn If TypeOf e.Control Is TextBox Thenrn Dim tb As TextBox = DirectCast(e.Control, TextBox)rn tb.KeyUp += New KeyEventHandler(AddressOf tb_KeyUp)rn End Ifrn End Subrnrn Private Sub tb_KeyUp(sender As Object, e As KeyEventArgs)rn If e.KeyCode = Keys.F3 Thenrn Dim form As New Form()rn form.ShowDialog()rn End Ifrn End SubrnEnd Class
下面代码怎么改写成vb.net
button1.Click+=new EventHandler(this.button1_Click);
怎么样把下面代码转成vb.net代码
'鼠标移动时不同行改变底色rn e.Item.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundcolor;this.style.banckgroundcolor='#9999cc'");rn e.Item.Attributes.Add("onmouseout", "this.style.backgroundcolor=currentcolor");rn 这段是我在书上找到的,是用于当鼠标移动时datagrid的不同行改变底色,可是我换成<em>vb.net</em>就完全没有作用,有知道的人请告诉我。rn小妹在这里谢过了。rn分数还可以在加的
求救:把vb.net代码转成vb代码
求救:把以下<em>vb.net</em><em>代码</em><em>转成</em>vb<em>代码</em>。谢谢rnrnImports SystemrnImports System.IOrnImports System.TextrnImports System.SecurityrnImports System.Security.Cryptographyrnrn' */rn' */rn' */rn'/ rn'/ 加密,解密功能函数rn'/ applern'/ rnPublic Class Encodern Public Sub New()rn End Subrnrn Private Shared m_Key() As Byte = New Byte(8) rn Private Shared m_IV() As Byte = New Byte(8) rnrn '为了安全,直接将key写死在文件中,你也可以用一个属性来实现rn Public key As String = "test$)"rn ' */rn ' */rn ' */rn '//////////////////////// rn '加密函数rn Public Function EncryptData(ByVal strKey As String, ByVal strData As String) As Stringrn Dim strResult As Stringrnrnrn '1. 字符大小不能超过90Kb. 否则, 缓存容易溢出rn If strData.Length > 92160 Thenrn strResult = "Error. Data String too large. Keep within 90Kb."rn Return strResultrn End Ifrnrn '2. 生成key rn If Not InitKey(strKey) Thenrn strResult = "Error. Fail to generate key for encryption"rn Return strResultrn End Ifrnrn '3. 准备处理的字符串rn '字符串的前个字节用来存储数据的长度rn '用这个简单的方法来记住数据的初始大小,没有用太复杂的方法rn strData = String.Format("0,5:00000" + strData, strData.Length)rnrnrn '4. 加密数据rn Dim rbData() As Byte = New Byte(strData.Length) rn Dim aEnc As ASCIIEncoding = New ASCIIEncoding()rn aEnc.GetBytes(strData, 0, strData.Length, rbData, 0)rn '加密功能实现的主要类rn Dim descsp As DESCryptoServiceProvider = New DESCryptoServiceProvider()rnrn Dim desEncrypt As ICryptoTransform = descsp.CreateEncryptor(m_Key, m_IV)rnrnrn '5. 准备streamrn ' mOut是输出流.rn ' mStream是输入流rn ' cs为转换流rn Dim mStream As MemoryStream = New MemoryStream(rbData)rn Dim cs As CryptoStream = New CryptoStream(mStream, desEncrypt, CryptoStreamMode.Read)rn Dim mOut As MemoryStream = New MemoryStream()rnrn '6. 开始加密rn Dim bytesRead As Integerrn Dim output() As Byte = New Byte(1024) rn Dorn bytesRead = cs.Read(output, 0, 1024)rn If bytesRead <> 0 Thenrn mOut.Write(output, 0, bytesRead)rn End Ifrn Loop While bytesRead > 0rnrn '7. 返回加密结果rn '因为是一个web项目,在这里转换为base64,因此在http上是不会出错的rn If mOut.Length = 0 Thenrn strResult = ""rn Elsern strResult = Convert.ToBase64String(mOut.GetBuffer(), 0, CType(mOut.Length, Integer))rn End Ifrnrn Return strResultrn End Functionrn ' */rn ' */rn ' */rn '//////////////////////// rn '解密函数rn Public Function DecryptData(ByVal strKey As String, ByVal strData As String) As Stringrn Dim strResult As Stringrnrn '1. 生成解密key rn If Not InitKey(strKey) Thenrn strResult = "Error. Fail to generate key for decryption"rn Return strResultrn End Ifrnrn '2. 初始化解密的主要类rn Dim nReturn As Integer = 0rn Dim descsp As DESCryptoServiceProvider = New DESCryptoServiceProvider()rn Dim desDecrypt As ICryptoTransform = descsp.CreateDecryptor(m_Key, m_IV)rnrn '3. 准备streamrn ' mOut为输出流rn ' cs为转换流rn Dim mOut As MemoryStream = New MemoryStream()rn Dim cs As CryptoStream = New CryptoStream(mOut, desDecrypt, CryptoStreamMode.Write)rnrn Dim bPlain() As Byte = New Byte(strData.Length) rn Tryrn bPlain = Convert.FromBase64CharArray(strData.ToCharArray(), 0, strData.Length)rn Catchrn strResult = "Error. Input Data is not base64 encoded."rn Return strResultrn End Tryrnrn Dim lRead As Long = 0rn Dim lTotal As Long = strData.Lengthrnrn Tryrn '5. 完成解密rn While lTotal >= lReadrn cs.Write(bPlain, 0, CType(bPlain.Length, Integer))rn lRead = mOut.Length + Convert.ToUInt32(((bPlain.Length / descsp.BlockSize) * descsp.BlockSize))rn End Whilernrnrn Dim aEnc As ASCIIEncoding = New ASCIIEncoding()rn strResult = aEnc.GetString(mOut.GetBuffer(), 0, CType(mOut.Length, Integer))rnrn '6.去处存储长度的前个字节的数据rn Dim strLen As String = strResult.Substring(0, 5)rn Dim nLen As Integer = Convert.ToInt32(strLen)rn strResult = strResult.Substring(5, nLen)rn nReturn = CType(mOut.Length, Integer)rnrn Return strResultrn Catchrn strResult = "Error. Decryption Failed. Possibly due to incorrect Key or corrputed data"rn Return strResultrn End Tryrn End Functionrn ' */rn ' */rn ' */rn '/////////////////////////////////////////////////////////// rn '生成key的函数rn Private Shared Function InitKey(ByVal strKey As String) As Booleanrn Tryrn ' 转换key为字节流rn Dim bp() As Byte = New Byte(strKey.Length) rn Dim aEnc As ASCIIEncoding = New ASCIIEncoding()rn aEnc.GetBytes(strKey, 0, strKey.Length, bp, 0)rnrn Dim sha As SHA1CryptoServiceProvider = New SHA1CryptoServiceProvider()rn Dim bpHash() As Byte = sha.ComputeHash(bp)rnrn Dim i As Integerrn ' 生成初始化DESCryptoServiceProvider的参数rn For i = 0 To 8 - 1 Step i + 1rn m_Key(i) = bpHash(i)rn Nextrnrn For i = 8 To 16 - 1 Step i + 1rn m_IV(i - 8) = bpHash(i)rn Nextrnrn Return Truern Catchrn '错误处理rn Return Falsern End Tryrn End FunctionrnEnd Classrn
C#代码转成delphi的
谁能帮我?这是一个服务启动窗口的<em>代码</em>。(终于找到点资料!也分享一下!)rnrnrnrnif(!flag) //如果没有找到rnrn HDESK hdeskCurrent;rn HDESK hdesk;rn HWINSTA hwinstaCurrent;rn HWINSTA hwinsta;rnrn hwinstaCurrent = GetProcessWindowStation();rnrn if (hwinstaCurrent == NULL)rn LogEvent(_T("get window station err"));rn return ;rn rnrn hdeskCurrent = GetThreadDesktop(GetCurrentThreadId());rn if (hdeskCurrent == NULL)rn LogEvent(_T("get window desktop err"));rn return ;rn rnrn//打开用户的winsta0rn hwinsta = OpenWindowStation("winsta0", FALSE, rn WINSTA_ACCESSCLIPBOARD |rn WINSTA_ACCESSGLOBALATOMS |rn WINSTA_CREATEDESKTOP |rn WINSTA_ENUMDESKTOPS |rn WINSTA_ENUMERATE |rn WINSTA_EXITWINDOWS |rn WINSTA_READATTRIBUTES |rn WINSTA_READSCREEN |rn WINSTA_WRITEATTRIBUTES);rn if (hwinsta == NULL)rn LogEvent(_T("open window station err"));rn return ;rn rnrn if (!SetProcessWindowStation(hwinsta))rn LogEvent(_T("Set window station err"));rn return ;rn rnrn //打开desktoprn hdesk = OpenDesktop("default", 0, FALSE, rn DESKTOP_CREATEMENU |rn DESKTOP_CREATEWINDOW |rn DESKTOP_ENUMERATE |rn DESKTOP_HOOKCONTROL |rn DESKTOP_JOURNALPLAYBACK |rn DESKTOP_JOURNALRECORD |rn DESKTOP_READOBJECTS |rn DESKTOP_SWITCHDESKTOP |rn DESKTOP_WRITEOBJECTS);rn if (hdesk == NULL)rn LogEvent(_T("Open desktop err"));rn return;rn rnrn SetThreadDesktop(hdesk); rnrn ::ShellExecute(0,NULL,"f:\\ivrtj\\DBA\\DBA_BJLDNW.exe",NULL,NULL,SW_MAXIMIZE);rn CString msg = "DBA_BJLDNW.exe 被重启动";rn LogEvent(msg);rnrn SetProcessWindowStation(hwinstaCurrent);rn SetThreadDesktop(hdeskCurrent);rn CloseWindowStation(hwinsta);rn CloseDesktop(hdesk);rn
新学习C#,求把下面VB.NET代码改成C#
求把<em>下面</em>VB.NET<em>代码</em>改成C#rn[code=vb]rn Using SqlConn1 As New SqlClient.SqlConnection(FormMain.SqlConnERP)rn SqlConn1.Open()rn Dim SqlComm1 As SqlClient.SqlCommand = SqlConn1.CreateCommand()rn Dim Transaction As SqlClient.SqlTransactionrnrn Transaction = SqlConn1.BeginTransaction("SampleTransaction") '以指定的事务名称启动数据库事务。rn SqlComm1.Connection = SqlConn1rn SqlComm1.Transaction = Transactionrn Tryrn SqlComm1.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')"rn SqlComm1.ExecuteNonQuery()rnrn SqlComm1.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')"rn SqlComm1.ExecuteNonQuery()rnrn Transaction.Commit() '提交数据库事务rn Catch ex As Exceptionrn Transaction.Rollback() '从挂起状态回滚事务。 rn End Tryrn SqlConn1.Close()rn End Usingrn[/code]
帮忙把下面这段vb.net代码改成c#代码
是关于在线人数和访问人数统计的<em>代码</em>,好像不能同时用vb和<em>c#</em>两种语言编写aspx文件吧,谢谢rnrnrnrn
C#代码转成vb代码
string UserPwd = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[4].Controls[0])).Text.Trim();rn这是gridview更新取某一个单元格的值,现在的问题转换成vb<em>代码</em>这个(Textbox)该放在什么地方,该<em>怎么</em>写呀?
这段c#代码转成vb怎么
要做个vb程序,但没学过,想请教一下这段该<em>怎么</em>写rnrn string sql1 = "select * from SECOND_DEPOT_INFO where SECOND_DEPOT_ID =" + 255;rn string sql2 = "insert into SECOND_DEPOT_INFO values (" + 255 + ",'所有')";rn SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MembershipProvider"].ConnectionString);rn con.Open();rn SqlCommand com = new SqlCommand(sql1, con);rn if (com.ExecuteScalar is Nullable)rn rn SqlCommand com2 = new SqlCommand(sql2, con);rn
C#怎么把字符串转成合法的代码
//结构rnpublic struct Struct1rnrn int AAA;rn int BBB;rn 。。。。。。rn //有很多rnrnrn//类rnpublic class Class1rnrn Struct1 myStruct;rnrnrn//实例化rnClass1 myClass=new Class1();rnrn然后实例化了一个类 myClass.myStruct.AAArn正常来说,<em>代码</em>写成 int a=myClass.myStruct.AAA; 就可以了rn现在的情况是 我知道一个字符串 string str1=“myClass.myStruct.AAA";rn<em>怎么</em>把这个字符串变成我需要<em>代码</em>?rn就是说根据字符串的值得到我想要的数据
请问这代码怎么转成C#
library Project1;rnrnusesrn SysUtils,rn Classes,rn forms,rn windows,rn Unit1 in 'Unit1.pas' Form1;rnrn$R *.resrnrnprocedure WinMain;rnvarrnrnfomr1:Tform;rnrnrnbeginrnform1:=tform1.Create(form1);rnform1.ShowModal;rnrnend;rnrnrnprocedure DllEntryPoint(hModule: HMODULE; Reason: Integer; lpReserved: Pointer);rnvarrnThread: DWORD;rnbeginrncase Reason Ofrn DLL_PROCESS_ATTACH:rn CreateThread(nil,0,@WinMain,nil,0,Thread);rn DLL_PROCESS_DETACH:rn CloseHandle(Thread);rnend;rnend;rnrnbeginrnDllProc:=@DLLEntryPoint;rnDLLEntryPoint(hInstance,DLL_PROCESS_ATTACH,nil);rnrnend.rnrn这是Delphi DLL文件中的<em>代码</em> 想问下C#该如何写?
怎么转成 C#
有这样一个 js 动画rn[img=https://img-bbs.csdn.net/upload/201606/12/1465730373_570137.gif][/img]rn原图rn[img=https://img-bbs.csdn.net/upload/201606/12/1465730731_118951.png][/img]rn<em>代码</em>如下,请问如何<em>转成</em> C# <em>代码</em>rn[code=html]rn sorry, no canvas, please, upgrade your browserrnrnrnrn rn[/code]
c# 下面代码
#region 读取未读的消息并显示到窗体中rn // 读取未读的消息并显示到窗体中rn private void GetMessage(string sql)rn rn string messageIdsString = ""; // 消息的Id字符串rnrn tryrn rn // 执行rn command = new SqlCommand(sql, SqlHelper.connection);rn SqlHelper.connection.Open();rn dataReader = command.ExecuteReader();rnrn // 循环将消息添加到窗体上rn while (dataReader.Read())rn rn // 记录未读消息的Idrn messageIdsString += Convert.ToString(dataReader["ID"]) + "_";rn RichTextBox rtb = new RichTextBox();rn /////////////rn //获取发信人ID和发信时间rn rtb.SelectionColor = Color.Blue;rn rtb.AppendText(string.Format("0 1", nickName, dataReader["MessageTime"].ToString()));rn rtbMessages.SelectedRtf = rtb.Rtf;rn // 获取发信内容rn byte[] bRead = (byte[])dataReader["_Message"];rn MemoryStream mstream = new MemoryStream(bRead);rn rtb.LoadFile(mstream, RichTextBoxStreamType.RichText);rn mstream.Close();rn rtbMessages.SelectionStart = rtbMessages.TextLength;rn rtbMessages.SelectedRtf = rtb.Rtf;rn rtbMessages.AppendText("\n");rn // 让文本框获取焦点rn this.rtbMessages.Focus();rn // 设置关标的位置到文本尾rn this.rtbMessages.Select(this.rtbMessages.TextLength, 0);rn // 滚动到控件标签处rn this.rtbMessages.ScrollToCaret();rn rn dataReader.Close();rn rn catch (Exception ex)rn rn MessageBox.Show(ex.Message);rn rn finallyrn rn SqlHelper.connection.Close();rn rnrn // 将显示过的消息设置为已读rn if (messageIdsString.Length > 1)rn rn // 去掉字符串尾部的下划线rn messageIdsString.Remove(messageIdsString.Length - 1);rn SetMessageToRead(messageIdsString, '_');rn rn rn #endregion rn[img=https://img-bbs.csdn.net/upload/201501/30/1422619298_851369.png][/img]rnSQL中原先_Message字段的数据类型是varbinary(Max) 现在是varchar(MAX) 现在<em>代码</em><em>怎么</em>改~
怎么下面代码转换成C#的
<em>下面</em>是一段VBS脚本调用的是WMI,着用是监视进程的创建rn请问下<em>怎么</em>转换成C#rnrnstrComputer = "."rnSet objWMIService = GetObject("winmgmts:" _rn & "impersonationLevel=impersonate!\\" & strComputer & "\root\cimv2")rnSet colMonitoredProcesses = objWMIService. _ rn ExecNotificationQuery("select * from __instancecreationevent " _ rn & " within 1 where TargetInstance isa 'Win32_Process'")rni = 0rnDo While i = 0rn Set objLatestProcess = colMonitoredProcesses.NextEventrn Wscript.Echo objLatestProcess.TargetInstance.NamernLooprn
下面代码中的部分vb.net代码怎么转换为c#代码
Dim objSQLConn As New _rnrn SqlConnection("SERVER=.;UID=sa;PWD=;DATABASE=NorthWind;")rnrn rnrn Dim objAdapter As SqlDataAdapterrnrn Dim objDataRow, objDBRow As DataRowrnrn Dim objDSXML As New DataSet()rnrn Dim objDSDBTable As New DataSet("tblBooks")rnrn Dim ObjCmdBuilder As SqlCommandBuilderrnrn rnrn objDSXML.ReadXml("C:\Books.xml")rnrn rnrn objSQLConn.Open()rnrn rnrn objAdapter = New SqlDataAdapter("SELECT BookTitle, Publisher, DateOfPurchase FROM tblBooks WHERE 1 = 2 ", objSQLConn)rnrn rnrn objAdapter.Fill(objDSDBTable, "tblBooks")rnrn rnrn For Each objDataRow In objDSXML.Tables(0).Rowsrnrn With objDSDBTable.Tables(0)rnrn objDBRow = .NewRow()rnrn rnrn objDBRow(0) = objDataRow(0)rnrn objDBRow(1) = objDataRow(1)rnrn objDBRow(2) = objDataRow(2)rnrn rnrn .Rows.Add(objDBRow)rnrn End Withrnrn rnrn ObjCmdBuilder = New SqlCommandBuilder(objAdapter)rnrn rnrn objAdapter.Update(objDSDBTable, "tblBooks")rnrn Nextrnrn rnrn objSQLConn.Close()rnrn rn
哪位高人帮我把下面这段VB.NET的代码转成C#的,在线ing
Private static object Level[,] As Object = New Object(,) _rn _rn ",", 0, _rn "=", 1, _rn ">=", 1, _rn "<>", 1, _rn ">", 1, _rn ", MAX_LEVEL _rn rn顺便加一问rnDim r As Decimal()rnReturn New Decimal(0) rrn这两句是什么意思,<em>转成</em>C#是<em>怎么</em>写,rn谢谢!
麻烦帮忙把这段c#代码转成vb.net
[StructLayout(LayoutKind.Sequential)]rn public struct DecodeMessagern rn [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]rn public Char[] message;rnrn [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]rn public Char[] codeID;rnrn [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]rn public Char[] symLetter;rnrn [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]rn public Char[] symModifer;rnrn public ushort length;rn ;
哪们老兄有把vb.net代码转成c#的方法?
哪们老兄有把<em>vb.net</em>的<em>代码</em><em>转成</em><em>c#</em>的方法?
帮我把这两句C#代码转成VB.NET,谢谢
顺便解释一下,谢谢rnrnMyDataGrid.EditItemIndex = (int)E.Item.ItemIndexrnrnint ProductID =(int)MyDataGrid.DataKeys[(int)E.Item.ItemIndex];
请高手将以下 C# 代码 转成 VB.NET????
关键是这句 o is linkbuttonrnif (o is LinkButton) rnrn  LinkButton h = (LinkButton) o;rn  h.Text = "[ " + h.Text + " ]"; rnrnelsernrn  Label l = (Label) o;rn  l.Text = "Page " + l.Text + ""; rn
请问这句VB.NET的代码转成C#该如何写?
Public Class ClsTimerrn ' Simple high resolution timer class rn ' rn ' Methods: rn ' StartTiming reset timer and start timing rn ' StopTiming stop timer rn ' rn 'Properties rn ' TotalTime Time in milliseconds rn 'Windows API function declarations rn Private Declare Function timeGetTime Lib "winmm" () As Longrnrn 'Local variable declarations rn Private lngStartTime As Integerrn Private lngTotalTime As Integerrn Private lngCurTime As Integerrnrn Public ReadOnly Property TotalTime() As Stringrn Getrn TotalTime = lngTotalTimern End Getrn End Propertyrnrn Public Sub StartTiming()rn lngTotalTime = 0rn lngStartTime = timeGetTime()rn End Subrnrn Public Sub StopTiming()rn lngCurTime = timeGetTime()rn lngTotalTime = (lngCurTime - lngStartTime)rn End SubrnEnd Classrnrn
哪为高手知道如何把vb.net代码转成C#??????
工作量很大,应该有转换工具吧??
谁能帮我把这VB.net的代码转成C#,谢谢!
-
这段VB.NET代码谁帮我转成C#的,谢了
不要从网上下的工具转,大多都有错的rn[code=VB.NET]rn Public Function aa(ByVal s As String) As Stringrn Dim kl As Integer = XORKey.Length, XORTorF As Boolean, sTp As Integer = 1rn If String.IsNullOrEmpty(s.Trim) = True Then Return ""rn Dim iPos As Integerrn Dim sCode As String = ""rn XORTorF = s.Substring(0, 1) = "-"rnrn If XORTorF = True Thenrn s = s.Substring(1)rn sTp = 2rnrn End Ifrn Dim l As Long = s.Lengthrn Dim a As Stringrn For i As Long = 0 To l - 1 Step sTprn If iPos >= kl Then iPos = 0rn Dim b As String = XORKey.Substring(iPos, 1)rn If XORTorF = True Thenrn a = s.Substring(i, 2)rn Dim c As Integer = CDec("&H" & a)rn sCode += Chr(c Xor Asc(b))rn Elsern a = s.Substring(i, 1)rn a = Hex(Asc(a) Xor Asc(b))rn a = IIf(Len(a) < 2, "0" + a, a)rn sCode += arn End Ifrnrn iPos += 1rnrn Nextrnrnrn Return IIf(XORTorF = True, sCode, "-" & sCode)rn End Functionrnrn[/code]
请把这段很简单的VB.NET转成C#代码,今晚给分
Public Function Memory() rn'==================================== rn' rn'服务器可用户内存 rn' rn'==================================== rnstrComputer = "." rnSet objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") rnFor i = 1 To 20 rnSet colItems = objWMIService.ExecQuery("Select * From Win32_PerfRawData_PerfOS_Memory") rnFor Each objItem In colItems rnintValue = objItem.AvailableMbytes rnrnMemory= "可用内存 = " & intValue & " MB" rn'Memory= intValue & " MB" rnNext rnNext rnEnd Function rnrnrn谢谢了,急用
帮我把下面代码转成C好么?
delphi好令人费解啊!!!!!!1rnrntypern TPlayAction=packed recordrn case integer ofrn 0:(rn Pos:integer;rn cmd:WORD;rn dwID_Lo:word;rn Son:word;rn dwID_Hi:word;);rn 1:(rn B1,B2,B3,B4:BYTE;rn B5,B6,B7,B8:BYTE;rn B9,BA,BB,BC:BYTE;rn )rn end;rnrn //2rn //BC_BA_B8_B6rn with Action do beginrn x3:=BC;rn x3:=x3 shl 8;x3:=x3 or BA;rn x3:=x3 shl 8;x3:=x3 or B8;rn x3:=x3 shl 8;x3:=x3 or B6;rn end;rn //3rn x1:=(Action.B5 xor XORBLOCK.B2);rn x1:=(x1 shl 8) or (Action.B1 xor XORBLOCK.B1);rn //...rn t:=Action.B7;rn t:=(t shl 8) or Action.B2;rn x1:=(x1 shl 16) or t;rn //X2=BBB4B9B3rn with Action dorn beginrn X2:=BB;rn x2:=x2 shl 8;x2:=x2 or B4;rn x2:=x2 shl 8;x2:=x2 or B9;rn x2:=x2 shl 8;x2:=x2 or B3;rn end;rnrn case x1 shr 16 of
请求把下面C#方法转成存储过程
作用是获取如下规则的编号 A+当天+序号。 A20110928001,A20110928002...rnrn[code=C#]public string GetReceiveNumber()rn rn string todayDateString = DateTime.Now.ToString("yyyyMMdd");rn string sql = "select max(reveive_number) from material_receive where subString( reveive_number,2,8)='" + todayDateString + "' ";rn DataSet ds = dal.GetDSBySQL(sql);rn if (ds.Tables[0].Rows[0][0].ToString() == "")rn rn return "A" + todayDateString + "001";rn rn elsern rn string sn = ds.Tables[0].Rows[0][0].ToString();rn return sn.Substring(0, 9) + (int.Parse(sn.Substring(9)) + 1).ToString().PadLeft(3, '0');rn rnrn rnrn rn [/code]
这个C#的代码用VB.net怎么
[System.ServiceProcess.ServiceControllerPermissionAttribute(SecurityAction.RequestMinimum,Unrestricted=true)] rn[WebMethod]rnrnrn写成下边这样是错误的呀,那应该<em>怎么</em>写?rn _ rn _
这段C#怎么转到VB.NET代码??
data.ToList().ForEach(x =>rn rn rn string[] array = new string[dt.Columns.Count];rn rn array[1] = x.Key;rn //从第二列开始遍历rn for (int i = 2; i < dt.Columns.Count; i++)rn rn // array[0] 就是 IDrn if (array[0] == null)rn array[0] = x.Items.ToList()[0]["ID"].ToString();rn rn array[i] = (from y in x.Itemsrn where y[2].ToString() == dt.Columns[i].ToString()rn select y[3].ToString() rn ).SingleOrDefault();rn rn dt.Rows.Add(array); //添加到table中rn );
这段VB.net代码,C#怎么写?
Public Function HTMLDecode(ByVal strHtmlCode As System.String) As System.Stringrn If Not IsDBNull(strHtmlCode) And Not IsNothing(strHtmlCode) Thenrn strHtmlCode = Replace(strHtmlCode, " ", Chr(10))rn strHtmlCode = Replace(strHtmlCode, " ", Chr(10) & Chr(10))rn strHtmlCode = Replace(strHtmlCode, "'", Chr(39))rn strHtmlCode = Replace(strHtmlCode, """, Chr(34))rn strHtmlCode = Replace(strHtmlCode, " ", Chr(32))rn strHtmlCode = Replace(strHtmlCode, "'", "'") '替换单引号rn strHtmlCode = Replace(strHtmlCode, "", ">")rn strHtmlCode = strHtmlCode.Replace("&", "&")rn HTMLDecode = strHtmlCodern End Ifrn End Function
这段VB.net代码用C#怎么写?
菜鸟问题rnrnPublic Class Catalogrn Private ReadOnly Property connectionString() as Stringrn Getrn Return ConfigurationSettings.AppSettings("ConnectionString")rn End Getrn End PropertyrnEnd Class
vb.net代码怎么用C#来替换
Public MustInherit Class TemplateTagrn Implements IDisposablernrn Public Overridable Sub preparePara(ByVal para As Hashtable)rnrn End Subrn Protected MustOverride ReadOnly Property StartTag() As Stringrnrn Protected MustOverride ReadOnly Property Endtag() As Stringrnrn Public Overridable Function isVaildedTag(ByVal str As String) As Booleanrn Return str.ToLower.StartsWith(StartTag.ToLower)rn End Functionrnrn Public Overridable Function getContent(ByRef str As String)rn Tryrn '開始しましたrn BASDTrace.PutLogFileStart("TemplateTag", "getContent")rnrn str = str.Substring(StartTag.Length)rn Dim endpos As Integer = str.ToLower.IndexOf(Endtag.ToLower)rn Dim content As String = str.Substring(0, endpos - 0)rn str = str.Substring(endpos + Endtag.Length)rn Return contentrnrn Finallyrn '終了しましたrn BASDTrace.PutLogFileEnd("TemplateTag", "getContent")rn End Tryrn End Functionrnrn Public MustOverride Function processSelf(ByVal str As String, ByVal para As Hashtable) As Stringrnrn Public Overridable Sub Dispose() Implements System.IDisposable.Disposernrn End Subrn End Classrnrn Public Class LoopTagrn Inherits TemplateTagrnrnrn Protected Overrides ReadOnly Property Endtag() As Stringrn Getrn Return vbCrLf & ":End Loop"rn End Getrn End Propertyrnrn Public Overrides Function processSelf(ByVal str As String, ByVal para As System.Collections.Hashtable) As Stringrn Tryrn '開始しましたrn BASDTrace.PutLogFileStart("LoopTag", "processSelf")rnrn Dim retval As Stringrn If para.Item(BatchTemplateParser.ParaKeys.LoopValues) Is Nothing Thenrn Return Nothingrn End Ifrn For Each loopvalue As Object In para.Item(BatchTemplateParser.ParaKeys.LoopValues)rn 'If para.Contains(BatchTemplateParser.ParaKeys.CurrentIot) Thenrn ' para.Remove(BatchTemplateParser.ParaKeys.CurrentIot)rn 'End Ifrn para.Item(BatchTemplateParser.ParaKeys.CurrentLoopValue) = loopvaluern If para.Item(BatchTemplateParser.ParaKeys.CurrentLoopIndex) Is Nothing Thenrn para.Item(BatchTemplateParser.ParaKeys.CurrentLoopIndex) = 0rn Elsern para.Item(BatchTemplateParser.ParaKeys.CurrentLoopIndex) += 1rn End Ifrn If Not retval Is Nothing Thenrn retval &= vbCrLfrn End Ifrn retval &= BatchTemplateParser.process(str, para)rn Nextrn para.Remove(BatchTemplateParser.ParaKeys.CurrentLoopValue)rn para.Remove(BatchTemplateParser.ParaKeys.CurrentLoopIndex)rn Return retvalrnrn Finallyrn '終了しましたrn BASDTrace.PutLogFileEnd("LoopTag", "processSelf")rn End Tryrn End Functionrnrn Protected Overrides ReadOnly Property StartTag() As Stringrn Getrn Return ":Start Loop" & vbCrLfrn End Getrn End Propertyrn End Class
一段vb.net代码怎么用C#实现?
If r("orderdesc") Is DBNull.Value Thenrn Me.Ntxtorder.Text = ""rn Elsern Me.Ntxtorder.Text = r("orderdesc")rn End Ifrn
怎么在C#使用一段vb.net代码
<em>vb.net</em>的一个function. 不想另建一个vb project.也不想<em>转成</em><em>c#</em>.就像在C#文件中。rn几年前做过C#中把<em>代码</em>当字符串读取,用vb 编译器编译,现在具体<em>怎么</em>写忘了,有没例子了?
Vb.net代码转C#
Class DChatServer rn ' Declare a multicast (because it has no return type) delegate typern Public Delegate Sub OnMsgArrived(ByVal message As String)rn ' Declare a reference to an OnMsgArrived delegatern ' Note: this field is private to prevent clients from removing or invoking delegatesrn Private Shared mOnMsgArrived As OnMsgArrivedrn ' The following method is used to provide clients a public method to add delegates to the onMsgArrived's invocation listrn Public Shared Sub ClientConnect(ByVal aDelegate As OnMsgArrived)rn DChatServer.mOnMsgArrived = _rn OnMsgArrived.Combine(DChatServer.mOnMsgArrived, aDelegate)rn End Subrn Public Shared Sub ClientDisconnect(ByVal aDelegate As OnMsgArrived)rn OnMsgArrived.Remove(DChatServer.mOnMsgArrived, aDelegate)rn End Subrn ' optional SendMsg helper method, not required by the labrn Public Shared Sub SendMsg(ByVal msg As String)rn ' Send message to ALL clientsrn SendMsg(msg, Nothing)rn End Subrn Public Shared Sub SendMsg(ByVal msg As String, ByVal excludeClient As Object)rn ' Send message to all clients except 'excludeClient'rn If (excludeClient Is Nothing) Thenrn mOnMsgArrived.Invoke(msg)rn Elsern Dim DelegateList As [Delegate]() = mOnMsgArrived.GetInvocationList()rn Dim i As Integerrn For i = 0 To (DelegateList.Length - 1)rn If Not (DelegateList(i).Target Is excludeClient) Thenrn CType(DelegateList(i), OnMsgArrived).Invoke(msg)rn End Ifrn Nextrn End Ifrn End Subrn ' Private to prevent instances of this type from being instantiated.rn Private Sub New()rn End SubrnEnd Classrn如何将 CType(DelegateList(i), OnMsgArrived).Invoke(msg)转为C#rn
c# 代码转VB.NET
public static CtoB()rn rnrnIEnumerator Iet1;rnIEnumerator Iet2;rnIDisposable Idp1;rn rntryrn rn ...rn rnfinallyrnrn Idp1 = (Iet1 as IDisposable);rn if (Idp1 != null)rn rn Idp1.Dispose();rn rn rnrnrn
vb.net代码转化成c#
Public Sub ResizeForm(FormName As Form)rn Dim Pos(4) As Doublern Dim i As Long, TempPos As Long, StartPos As Longrn Dim Obj As Controlrn Dim ScaleX As Double, ScaleY As Doublern rn ScaleX = FormName.ScaleWidth / FormOldWidthrn '保存窗体宽度缩放比例rn ScaleY = FormName.ScaleHeight / FormOldHeightrn '保存窗体高度缩放比例rn On Error Resume Nextrn For Each Obj In FormNamern StartPos = 1rn For i = 0 To 4rn '读取控件的原始位置与大小rn TempPos = InStr(StartPos, Obj.Tag, " ", vbTextCompare)rn If TempPos > 0 Thenrn Pos(i) = Mid(Obj.Tag, StartPos, TempPos - StartPos)rn StartPos = TempPos + 1rn Elsern Pos(i) = 0rn End Ifrn '根据控件的原始位置及窗体改变大小的比例对控件重新定位与改变大小rn Obj.Move Pos(0) * ScaleX, Pos(1) * ScaleY, Pos(2) * ScaleX, Pos(3) * ScaleYrn Next irn Next Objrn On Error GoTo 0rnEnd Subrn哪位大哥能帮个忙,把上面的<em>代码</em>转化成<em>c#</em>rn
C#与VB.NET代码互转
C#与VB.NET<em>代码</em>互转
c#代码转VB.NET
请将以下<em>代码</em>转VB.NET,谢谢。rnrnusing System;rnusing System.Collections.Generic;rnusing System.Linq;rnusing System.Web;rnusing Enyim.Caching;rnrnnamespace BBS.Corernrn public class CrossSiteLoginInfoHelperrn rn public static string Set(string userID)rn rn string token = Guid.NewGuid().ToString("N");rn return Set(token, userID) ? token : "";rn rnrn public static bool Set(string token, string userID)rn rn using (MemcachedClient client = new MemcachedClient())rn rn return client.Store(Enyim.Caching.Memcached.StoreMode.Set, token, userID);rn rn rnrn public static string Get(string token)rn rn using (MemcachedClient client = new MemcachedClient())rn rn return client.Get(token);rn rn rnrn public static string GetAndRemove(string token)rn rn using (MemcachedClient client = new MemcachedClient())rn rn string str = client.Get(token);rn client.Remove(token);rn return str;rn rn rn rn
vb.net代码翻译成c#
<em>下面</em>几句<em>vb.net</em><em>代码</em>如何翻译成<em>c#</em>rnrn Dim resolved As IPHostEntryrnrn Dim name As String = ""rnrn If resolved IsNot Nothing Then name = """" & resolved.HostName & """ "rnrnrn
c#代码翻译成vb.net
mybutton.Command +=new CommandEventHandler(mybutton_Command);rnmybutton.CommandArgument = "mybutton"+x.ToString();rnrnprivate void mybutton_Command(object sender,CommandEventArgs e)rnrn //这里写处理的<em>代码</em>!rnrnrn上面的<em>代码</em>用<em>vb.net</em><em>怎么</em>写??
VB.net 代码 to C#!
' Events rnProtected Event GetMsgEvent(ByVal vstrMsg As String)rn...rnProtected Function GetMsg() As Stringrn If sckSocket.Connected Thenrn Static strMsgBuffer As String = ""rn ' Get the byte cound and dern Dim BytesGot As Integer = sckSocket.Receive(arrBuffer, arrBuffer.Length, SocketFlags.None)rn ' Check data was returnedrn If BytesGot > 0 Thenrn ' Retreive the next set of bytesrn RaiseEvent GetMsgEvent(Encoding.ASCII.GetString(arrBuffer, 0, BytesGot))rn ' Return the buffer as a stringrn Return Encoding.ASCII.GetString(arrBuffer, 0, BytesGot)rn End Ifrn End Ifrn Return ""rnEnd Functionrn...rn麻烦帮我转换一下,最主要是RaiseEvent的转换
C#代码转换成vb.net
for(int i=1;record!=null&&i).ToString());rn this.lstViewAttribute.Items[i-1].SubItems.Add(strFill);rn this.lstViewAttribute.Items[i-1].SubItems.Add(strCut);rn record.MoveNext();rn rn请问以上C#<em>代码</em><em>怎么</em>转换成<em>vb.net</em>的<em>代码</em>,谢谢了.
C#代码转VB.net
本人对其他语言一窍不通,烦请高手将<em>下面</em>的<em>代码</em><em>转成</em>VB的,非常感谢!rnrnusing System; rnusing System.Collections.Generic; rnusing System.Text; rnusing System.IO.Ports; rnusing System.Threading; rnrnnamespace CommPort rn rnrn enum optype rn rn Continues, rn Orders rn rnrn /// rn /// 串口操作类 rn /// rn public class CommOp rn rn private SerialPort commport ; rnrn List list = new List(); rnrn /// rn /// 设置标示位,防止close时存在I/O操作 rn /// rn bool sign = false; rnrn /// rn /// 自定义串口操作类构造函数 rn /// rn /// rn public CommOp(SerialPort sp) rn rn this.commport = sp; rn rnrn public CommOp() rn rn rn rn /// rn /// 通过上位机指令方式(由通讯协议获得,如:02 41 42 30 33 03)获取数据rn /// rn /// rn public string GetDataByOrder(byte[] byts) rn rn string strReceive = ""; rnrn if (sign) rn rn //发送读取指令 rn commport.Write(byts, 0, byts.Length); rnrn //等待数据进入缓冲区 rn Thread.Sleep(500); rnrn //接收缓冲区中数据的字节数 rn int int_Len = commport.BytesToRead; rnrn //接收数据 rn byte[] bytes = new byte[int_Len]; rn commport.Read(bytes, 0, int_Len); rnrn //将数据存入字符串缓冲区中 rn if (int_Len >= 12) rn rn for (int i = 0; i < bytes.Length; i++) rn rn list.Add(bytes[i]); rn rnrn strReceive = System.Text.Encoding.Default.GetString(list.ToArray()); rnrn list.Clear(); rn rn rnrn return GetWeightData(strReceive, optype.Orders); rn rnrn /// rn /// 根据通讯协定分析传输数据(如,有效数据位,小数点位等) rn /// rn /// rn /// rn private string GetWeightData(string data,optype type) rn rn rn double d = 0; rnrn switch (type) rn rn case optype.Orders: rn d = Convert.ToDouble(data.Substring(4, 6)) / Math.Pow(10, Convert.ToDouble(data.Substring(10, 1))); rn break; rn case optype.Continues: rn d = Convert.ToDouble(data.Substring(1, 6)) / Math.Pow(10, Convert.ToDouble(data.Substring(7, 1))); rn break; rn rnrnrn return d.ToString().PadLeft(7,'0'); rnrn rnrn /// rn /// 打开串行接口 rn /// rn public void Open() rn rn rn try rn rn if (!commport.IsOpen) rn rn commport.Open();//打开串口方法 rn Thread.Sleep(1500); rn sign = true; rn rnrn //抛出异常 rn catch (Exception ex) rn rn throw new Exception(ex.Message); rn rn rnrn /// rn /// 关闭串行接口 rn /// rn public void Close() rn rn try rn rn if (commport.IsOpen) rn rn sign = false; rn Thread.Sleep(1500); rn commport.DiscardInBuffer(); rn commport.Close(); rn rn rn catch (Exception ex) rn rn throw new Exception(ex.Message); rn rn rn rn rnrn
VB.NET的代码转为C#
Dim WithEvents RecoContext As SpeechLib.SpSharedRecoContextrn Dim Grammar As SpeechLib.ISpeechRecoGrammarrn rn Dim m_bRecoRunning As Booleanrn Dim m_cChars As Shortrn rn rn Private Sub SimpleDict_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Loadrn SetState(False)rn m_cChars = 0rn End Subrn rn Private Sub btnStart_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles btnStart.Clickrn System.Diagnostics.Debug.Assert(Not m_bRecoRunning, "")rn If (RecoContext Is Nothing) Thenrn RecoContext = New SpeechLib.SpSharedRecoContextrn Grammar = RecoContext.CreateGrammar(1)rn Grammar.DictationLoad()rn End Ifrn rn Grammar.DictationSetState(SpeechLib.SpeechRuleState.SGDSActive)rn SetState(True)rn End Subrn rn Private Sub btnStop_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles btnStop.Clickrn System.Diagnostics.Debug.Assert(m_bRecoRunning, "")rn Grammar.DictationSetState(SpeechLib.SpeechRuleState.SGDSInactive)rn SetState(False)rn End Subrn rnrn Private Sub RecoContext_Recognition(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) Handles RecoContext.Recognitionrn Dim strText As Stringrn strText = Result.PhraseInfo.GetTextrn txtSpeech.SelectionStart = m_cCharsrn txtSpeech.SelectedText = strText & " "rn m_cChars = m_cChars + 1 + Len(strText)rn End Subrn Private Sub SetState(ByVal bNewState As Boolean)rn m_bRecoRunning = bNewStatern btnStart.Enabled = Not m_bRecoRunningrn btnStop.Enabled = m_bRecoRunningrn End Subrnrnrn这段<em>代码</em>如何转为C#呢?
c#代码转换成vb.net??????
以确保用户仅输入正整数。rnrnprivate void dataGridView1_CellValidating(object sender,rn DataGridViewCellValidatingEventArgs e)rnrn dataGridView1.Rows[e.RowIndex].ErrorText = "";rn int newInteger;rnrn // Don't try to validate the 'new row' until finished rn // editing since therern // is not any point in validating its initial value.rn if (dataGridView1.Rows[e.RowIndex].IsNewRow) return; rn if (!int.TryParse(e.FormattedValue.ToString(),rn out newInteger) || newInteger < 0)rn rn e.Cancel = true;rn dataGridView1.Rows[e.RowIndex].ErrorText = "the value must be a non-negative integer";rn rnrn
C#的代码转到VB.net
1.rnBegin数据处理函数UIDelegate Begin数据处理函数UI = new Begin数据处理函数UIDelegate(this.Begin数据处理函数UI);rnobjthisForm.Invoke(Begin数据处理函数UI,new object[]li处理);rn2.rn Private Sub AfterSetDispParam(ByVal iDispParam As DispParam)rn Tryrn SetDispParamrn If Not (Me.AfterSetDispParamEvent Is Nothing) Thenrn Me.AfterSetDispParamEvent(iDispParam)rn End Ifrn Catch e As Exceptionrn System.Console.WriteLine(e.ToString)rn End Tryrn End Subrn各位高手,这<em>代码</em>在<em>vb.net</em>该如何写呢?rn
下面代码怎么封装?
我的<em>代码</em>里面有很多rn[code=c]rn//省略<em>代码</em>rnchar szName[128] = 0;rnfor (int i=0; i, i+1);rn //省略<em>代码</em>rnrn//省略<em>代码</em>rn[/code]rnrn里面除了sprintf产生的szName不一样,其他的完全一样。请教大牛们,这该<em>怎么</em>封装?
下面代码怎么理解
String url = response.encodeRedirectURL("/Myday07/servlet/ListCartServlet");rnrnresponse.sendRedirect(url);rn
下面代码怎么错了?
先绑定部门rnDataSet ds = DbClass.getDateSet(TrainPerson);rn int i = ds.Tables[0].Rows.Count;rn int x = ds.rows[0]["INFO_ID"].ToString();、、得到部门表的Id值。但这里却报 CS0117: “System.Data.DataSet”并不包含“rows”的定义 的错误。。。。。我那些错了。???rnrn _TrainPerson.RecordCount = i.ToString();rn DbClass.BindGridView(TrainPerson, TrainPerson_gv);rn //部门绑定结束rn //部门内部人员的绑定循环rn string TrainMan = "select P_ID,P_NAME from RS_Person where P_DEPARTMENT ="+x+"";、、此部门人员绑定rn DataSet ds1 = DbClass.getDateSet(TrainMan);rn int k = ds1.Tables[0].Rows.Count;rn _TrainPerson.RecordCount = i.ToString();rn DbClass.BindGridView(TrainMan, TrainPerson_gv);
怎么简化下面代码
[code=php]if($_MODULE[huoqubaobei]!="4")rnrn $i=-1;rn $j=0;rn foreach($items as $item)rn $i++;rn $itemUrl = $uriManager->detailURI($item); rn $itemPicUrl = $item->getPicUrl(310);rn $itemTitle = $item->title;rn $itemPrice = $item->price;rn $itemsoldCount = $item->soldCount; rnecho' rnrnrn rn'.$itemTitle.'rn¥rn'.$itemPrice.'rnrnrnrn';rn rnrnelse if($_MODULE[huoqubaobei]=="4")rnrn $num = count($srtpdz);rn for($i=0;$i;rn rn [/code]rnrn这个地方div+css写重复了 我想不重复<em>怎么</em>写。。我想了几个小时也想不出好的方法 主要这个循环蛋疼。。
这段屏蔽Webbrowser弹窗的代码怎么转成vb.net的呢?
Dim WithEvents Web_V1 As SHDocVwCtl.WebBrowser_V1rnrnPrivate Sub Form_Load()rnDim WebBrowser1 As WebBrowserrnrn WebBrowser1.Navigate2 "http://www.163.com/"rnEnd SubrnPrivate Sub Web_V1_NewWindow(ByVal URL As String, _rn ByVal Flags As Long, _rn ByVal TargetFrameName As String, _rn PostData As Variant, _rn ByVal Headers As String, _rn Processed As Boolean)rnrn Processed = Truern WebBrowser1.Navigate URLrn Me.Caption = URLrnEnd Subrnrnrn
vb.net写的程序可不可以转成C#的?
用<em>vb.net</em>写的程序可不可以<em>转成</em>C#的?rn就是把<em>代码</em>换成<em>c#</em>
在把C#转成vb.net时出现在错误?
首先:我想问的是,在<em>vb.net</em>中把别人写的<em>c#</em>编写的dll直接引用过来,这个dll是能直接用并且不用改写里面的<em>代码</em>的吧?rnrn第二:C#中的OutlookBar outlookBar=new OutlookBar();rn       这句是在form1里,是正确的。rn    但是转换成<em>vb.net</em>后, Dim outlookBar As OutlookBar = New OutlookBarrn       语法应该是对的,但它说OutlookBar需要类型rn      rn     C#里是正确的,为什么在<em>vb.net</em>会没有类型呢??rnrn  求解,谢谢大家!
免费短信猫二次开发包下载,支持多种程序开发语言下载
免费短信猫二次开发包下载,支持多种程序开发语言 简介: 此短信猫二次开发包为短信猫厂家配送,开源、免费,,支持C#、C++、Delphi、VB.net等开发语言,并提供有短信二次开发示例程序供参考开发。 此短信猫二次开发包是基于动态链接库技术,具有开发扩展性大、支持多种开发语言、节省内存等优点,可无缝嵌入企业办公OA系统、第三方软件系统、客户管理系统、监控系统等应用系统当中。 相关下载链接:[url=//download.csdn.net/download/sms_hb/3915787?utm_source=bbsseo]//download.csdn.net/download/sms_hb/3915787?utm_source=bbsseo[/url]
一个非常好的视频播放器下载
一个非常好的视频播放器,能够流畅的播放各种视频文件 相关下载链接:[url=//download.csdn.net/download/u014639088/7825677?utm_source=bbsseo]//download.csdn.net/download/u014639088/7825677?utm_source=bbsseo[/url]
SimpleTV非常有好评!下载
SimpleT在网电视非常有好评! 相关下载链接:[url=//download.csdn.net/download/pixw3/8373967?utm_source=bbsseo]//download.csdn.net/download/pixw3/8373967?utm_source=bbsseo[/url]
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数
我们是很有底线的