VB.NET 转 C# 提示现用语言不支持 [问题点数:20分]

Bbs1
本版专家分:20
结帖率 94.12%
Bbs6
本版专家分:6985
Blank
GitHub 绑定GitHub第三方账户获取
Blank
黄花 2019年8月 .NET技术大版内专家分月排行榜第二
Bbs5
本版专家分:4872
Bbs5
本版专家分:2757
Bbs7
本版专家分:15743
Bbs5
本版专家分:3222
Blank
蓝花 2019年5月 .NET技术大版内专家分月排行榜第三
Bbs8
本版专家分:30938
版主
Blank
脉脉勋章 绑定脉脉第三方账户获取
Blank
GitHub 绑定GitHub第三方账户获取
Blank
领英 绑定领英第三方账户获取
Bbs7
本版专家分:20197
Blank
GitHub 绑定GitHub第三方账户获取
VB.NET转C#
想提问一下.在.NET中如何将VB.NET的代码转化成C#或别的<em>语言</em>形式的代码?
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#
请问rn 那一位高手把下列网址rnhttp://www.aspx2.com/vbnet/PrintDocumentDuiXiangShi.htmlrn 中的<em>vb.net</em>转C#rn 谢谢!
C#语句转vb.net
请问下面这条C#语句怎么转换成<em>vb.net</em>的rnrnfor(int i=1;record!=null&&i<=record.RecordCount;i++)
vb.net 转C#问题
下面代码转化为C#代码是什么样子?建立什么样的项目(VS2005)能编译?rnrn _rnPublic Class InstaPenReaderIO2rn Implements Anoto.Notification.IDataReceiverrnrn#Region "COM GUIDs"rn ' These GUIDs provide the COM identity for this class rn ' and its COM interfaces. If you change them, existing rn ' clients will no longer be able to access the class.rn Public Const ClassId As String = "EC70BFC5-0C9C-4042-B1D9-71D8541A4DB6"rn Public Const InterfaceId As String = "97DD0E81-94FF-48CC-B21B-72BE081ABB38"rn Public Const EventsId As String = "332A9516-C71B-47B4-8FFA-5907FCA7E5BE"rn#End Regionrnrn ' A creatable COM class must have a Public Sub New() rn ' with no parameters, otherwise, the class will not be rn ' registered in the COM registry and cannot be created rn ' via CreateObject.rn Public Sub New()rn MyBase.New()rn End Subrnrn Public Sub InsaPenTester()rn MsgBox("Class InstaPenReader, current time is " & CStr(Now()), MsgBoxStyle.Exclamation Or MsgBoxStyle.OKOnly)rn End Subrnrn Private ReadOnly Property Category() As String Implements Anoto.Notification.IDataReceiver.Categoryrn Getrn Return "kti::instaIO2"rn End Getrn End Propertyrnrn Public Sub Notify(ByVal cat As String, ByVal inData As Object) Implements Anoto.Notification.IDataReceiver.Notifyrnrn WriteLogFile("=============sudianbo")rnrnrn End Subrn Public Function WriteLogFile(ByVal value As String)rn Dim g_AppData As Stringrn Dim g_LogFileName As Stringrn g_AppData = "D:\sudianbo"rn Dim LogFile As System.IO.StreamWriterrn g_LogFileName = g_AppData & "\LogFiles\" & Format(Now().Date, "yyyy-MM-dd") & "\" & "PenDataLog_" & ".log"rn If Dir(g_LogFileName) = "" Thenrn LogFile = System.IO.File.CreateText(g_LogFileName)rn Elsern LogFile = System.IO.File.AppendText(g_LogFileName)rn End Ifrn LogFile.Write(value & vbCrLf)rn LogFile.Close()rn End FunctionrnrnEnd Class
C#代码转VB.net
本人对其他<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#的问题
在<em>vb.net</em> 中定义了Private parameterHash As Hashtable;rn然后:rnparameterHash = New Hashtablern 。。。。。rn parameterHash.Add("region", New List(Of Integer))rnrn。。。。rnrn转成<em>c#</em>中:rnrnint b = Int32.Parse(parameterHash["region"].ToString());报错输入的格式不正确rnrn<em>c#</em>要怎么写才能把region的值取出来?谢谢
C# 转 vb.net
我在学习加密解密时,看到一下的C#代码,但无法转换到<em>vb.net</em>,想请大家帮忙。rn(原文在http://blog.163.com/liguoxin_5260/blog/static/2130270200822114345296/)rnrn  // 数据已经写入内存但是我们需要回显它到TextBox和MessageBox中,因此要做下面的工作。rnrn  // 为接受数据创建字节数组。rnrn  byte[] mBytes = new byte[mMemStr.Length - 1];rnrn  mMemStr.Position = 0;rnrn  mMemStr.Read(mBytes,0,mMemStr.Length);rnrn  Text.UTF8Encoding mEnc = new Text.UTF8Encoding();rnrn  String mEncData = mEnc.GetString(mBytes);rnrn
vb.netc# 问题
以前都试用<em>vb.net</em>开发的,现在想转成<em>c#</em>的,一开始就遇到个困难,艾,,求救rn Public Class bbs vb类的顶部会有这个语句,现在想改成C#的,这句话要怎么改?rn
vb.netc#
dim aa() as doublernpublic property AA(byval i as inter) as doublernrngetrnreturn aa(i)rnend getrnset(byval value as double)rnaa(i)=valuernend setrnrn怎么转换成<em>c#</em> 参数i怎么传进去
vb.netc#的问题
我将<em>vb.net</em>的程序转变为<em>c#</em>程序时,我把<em>vb.net</em>前端页面的Html粘贴到<em>c#</em>前端页面rn.但我点击“设计”时,前端页面没有生成。所报错误为:未能将“设计”视图打开rn在块中,以不同方式将值括起来。rn ','','scrollbars=yes,width=570,height=405')"> rn rn rn rn 类型rn rn rn rn " target="_blank">附件 rn rn rn
C#表达式转VB.Net
如题 将以下代码转换成<em>vb.net</em>rnrnprivate int col = -1;rnrnPoint location = col == 0 ? new Point(0, rect.top) : new Point( rect.left, rect.top);rnrnrn通过 [url=http://www.developerfusion.com/tools/convert/csharp-to-vb]developerfusion[/url] Convert C# to VB.NET转换成Dim location As Point = If(col = 0, New Point(0, rect.top), New Point(rect.left, rect.top))是错误的 rnrn Me.textBox.Leave += New EventHandler(textBox_Leave)rn“Public Event Leave(sender As Object, e As System.EventArgs)”是事件,不能直接调用。请使用“RaiseEvent”语句引发事件。 rnrn 这个错误怎么解决呀rnrn求大侠帮忙rn
C#转VB.net工具
很好用的国外软件。可以把大量的C#代码编译成VB.net.但是工具毕竟是工具。肯定会有BUG的
c#代码转VB.NET
请将以下代码转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
C#转vb.net
[color=#FF0000] rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn [/color]
C# 转 VB.net
public int Ascii2Hex(char p)rn rn if ((p >= '0') && (p = 'A') && (p = 'a' && p + 0xa);rn rn return -1;rn
*****告急:vb.netc#
求高手转一段代码,将下面的<em>vb.net</em>转成<em>c#</em>rn[code=VB.NET]rn'创建oMTM自动化模型组件 rnSet oMTM = CreateObject("MultiTestManager.Application") rn rn'获取报告设置对象 rnSet oReportSettings = oMTM.Preferences.ReportSettings rn'获取运行设置对象 rnSet oRunSettings = oMTM.Preferences.RunSettings rn rn'设置为可见模式 rnoMTM.Visible = True rn rn'设置运行后关闭QTP以及MTM rnoRunSettings.CloseQuickTest = True rnoRunSettings.CloseTestManager = True rn rn'设置创建报告,并在运行完毕后打开报告 rnoReportSettings.CreateReport = True rnoReportSettings.ReportName = "IQuickTest Report" rnoReportSettings.ViewReport = True rn rn rn'加载需要执行的脚本,并设置为 rnoMTM.AddTestScript "c:\test1",True rnoMTM.AddTestScript "c:\test2",True rnoMTM.AddTestScript "c:\test3",False rn rn'执行脚本 rnoMTM.Run rn rn'直到运行完毕 rnWhile oMTM.IsRunning : Wend rn rn'释放对象 rnSet oRunSettingss = Nothing rnSet oReportSettings = Nothing rnSet oMTM = Nothing rn[/code]
vb.netc#
可以将<em>vb.net</em>代码转换成c sharp代码的小软件
C#转换为VB.NET
this.candle.GetPointerStyle += new CustomPoint.GetPointerStyleEventHandler(candle_GetPointerStyle);rn void candle_GetPointerStyle(CustomPoint series, CustomPoint.GetPointerStyleEventArgs e)rn rn e.Style= PointerStyles.Rectangle;rn SeriesOHLCPoint _ojlc = ((Steema.TeeChart.Styles.Candle)(series))[e.ValueIndex];rn ((Steema.TeeChart.Styles.Candle)(series)).HighLowPen.Color = Color.Empty;rn if (_ojlc.Close > _ojlc.Open)rn rn e.Style = Steema.TeeChart.Styles.PointerStyles.Diamond;rn series.Pointer.Pen.Color = Color.Red;rn rn elsern rn e.Style = Steema.TeeChart.Styles.PointerStyles.Diamond;rn series.Pointer.Pen.Color = Color.Green;rn rn
C#匿名方法转VB.net
在.net2.0里面 我建立的匿名方法如何转VB.net?rn(注意:匿名方法里面使用了外部方法的变量)rnrn请高人给个小DEMO rn
for each 的vb.net转C#
[code=VB.NET]Cache("Cache1")="Value1"rnCache.Insert("Cache2","Value2")rnDim obj As ObjectrnFor Each obj In Cachern Response.Write("Cache 名称:" & obj.Key & " " & _"Cache 内容:" & Cache(obj.Key).ToString &" ")rnNext[/code]
C#转换为vb.net
private Dictionary _nodes =rn new Dictionary(16);rn请问,这样的定义转换为<em>vb.net</em>的定义是怎么样的?
C#提示不支持写入
下面代码<em>提示</em>流<em>不支持</em>写入,怎么办??解决??rn byte[] bArray = new byte[53];rn FileStream fs = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read);rn tryrn byte[] data = new byte[fs.Length];rn fs.Seek(0,16);rn fs.Write(bArray,0,16); //这句出错了rn rn catch(Exception ex)rn rn MessageBox.Show(ex.Message);rn rn //MessageBox.Show(Convert.ToSByte(data));rnfs.Close();
c 语言转换为vb.net
哪位大侠能帮我把下面代码 改成 VB.NET 吗rnprivate void treeListDsh_CustomDrawNodeIndicator(object sender, DevExpress.XtraTreeList.CustomDrawNodeIndicatorEventArgs e)rn rn DevExpress.XtraTreeList.TreeList tmpTree = sender as DevExpress.XtraTreeList.TreeList;rn DevExpress.Utils.Drawing.IndicatorObjectInfoArgs args = e.ObjectArgs as DevExpress.Utils.Drawing.IndicatorObjectInfoArgs;rn if (args != null)rn rn int rowNum = tmpTree.GetVisibleIndexByNode(e.Node) + 1;rn args.DisplayText = rowNum.ToString();rn rn e.ImageIndex = -1; rn
C#转换为VB.NET工具
C#转换为VB.NET工具 C#转换为VB.NET工具
C#代码转换到VB.Net
class DragHelperrn rn [DllImport("comctl32.dll")]rn public static extern bool InitCommonControls();rnrn [DllImport("comctl32.dll", CharSet = CharSet.Auto)]rn public static extern bool ImageList_BeginDrag(IntPtr himlTrack, intrn iTrack, int dxHotspot, int dyHotspot);rnrn [DllImport("comctl32.dll", CharSet = CharSet.Auto)]rn public static extern bool ImageList_DragMove(int x, int y);rnrn [DllImport("comctl32.dll", CharSet = CharSet.Auto)]rn public static extern void ImageList_EndDrag();rnrn [DllImport("comctl32.dll", CharSet = CharSet.Auto)]rn public static extern bool ImageList_DragEnter(IntPtr hwndLock, int x, int y);rnrn [DllImport("comctl32.dll", CharSet = CharSet.Auto)]rn public static extern bool ImageList_DragLeave(IntPtr hwndLock);rnrn [DllImport("comctl32.dll", CharSet = CharSet.Auto)]rn public static extern bool ImageList_DragShowNolock(bool fShow);rnrn static DragHelper()rn rn InitCommonControls();rn rn
C#代码转VB.net的问题
[code=C#]rn public interface IWebBrowser2rn rn[DispId(200)]rn object Application [return: MarshalAs(UnmanagedType.IDispatch)] get; rn [DispId(0xc9)]rn object Parent [return: MarshalAs(UnmanagedType.IDispatch)] get; rn [DispId(0xca)]rn object Container [return: MarshalAs(UnmanagedType.IDispatch)] get; rn [DispId(0xcb)]rn object Document [return: MarshalAs(UnmanagedType.IDispatch)] get; rnrn[/code]rnrnrn如何转成VB.net的?rnrn貌似VB.net接口<em>不支持</em>object Application [return: MarshalAs(UnmanagedType.IDispatch)] get; 这种写法
VB.net转C#(内含注册机)
VB.net转C#(内含注册机), VBConversions' VB.Net to C# Converter是一款代码转换软件,将用户的VB.Net项目用C#<em>语言</em>重新编写。与别的转换软件不同,变量名、注释行、ad inline comments都被保留下来,代码转换的准确率超过99%. 此压缩包内有注册机哦!
求助!VB.NET转C#代码
试过很多代码转换程序,出来的代码都不能通过编译,麻烦哪位达人帮帮忙吧, rnrn附代码:md5算法rnrnPublic Class CMD5rnrn Private Const BITS_TO_A_BYTE = 8rn Private Const BYTES_TO_A_WORD = 4rn Private Const BITS_TO_A_WORD = 32rnrn Private m_lOnBits(30)rn Private m_l2Power(30)rnrn Private Function LShift(ByVal lValue, ByVal iShiftBits)rn If iShiftBits = 0 Thenrn LShift = lValuern Exit Functionrn ElseIf iShiftBits = 31 Thenrn If lValue And 1 Thenrn LShift = &H80000000rn Elsern LShift = 0rn End Ifrn Exit Functionrn ElseIf iShiftBits < 0 Or iShiftBits > 31 Thenrn Err.Raise(6)rn End Ifrnrn If (lValue And m_l2Power(31 - iShiftBits)) Thenrn LShift = ((lValue And m_lOnBits(31 - (iShiftBits + 1))) * m_l2Power(iShiftBits)) Or &H80000000rn Elsern LShift = ((lValue And m_lOnBits(31 - iShiftBits)) * m_l2Power(iShiftBits))rn End Ifrn End Functionrnrn Private Function RShift(ByVal lValue, ByVal iShiftBits)rn If iShiftBits = 0 Thenrn RShift = lValuern Exit Functionrn ElseIf iShiftBits = 31 Thenrn If lValue And &H80000000 Thenrn RShift = 1rn Elsern RShift = 0rn End Ifrn Exit Functionrn ElseIf iShiftBits < 0 Or iShiftBits > 31 Thenrn Err.Raise(6)rn End Ifrnrn RShift = (lValue And &H7FFFFFFE) \ m_l2Power(iShiftBits)rnrn If (lValue And &H80000000) Thenrn RShift = (RShift Or (&H40000000 \ m_l2Power(iShiftBits - 1)))rn End Ifrn End Functionrnrn Private Function RotateLeft(ByVal lValue, ByVal iShiftBits)rn RotateLeft = LShift(lValue, iShiftBits) Or RShift(lValue, (32 - iShiftBits))rn End Functionrnrn Private Function AddUnsigned(ByVal lX, ByVal lY)rn Dim lX4rn Dim lY4rn Dim lX8rn Dim lY8rn Dim lResultrnrn lX8 = lX And &H80000000rn lY8 = lY And &H80000000rn lX4 = lX And &H40000000rn lY4 = lY And &H40000000rnrn lResult = (lX And &H3FFFFFFF) + (lY And &H3FFFFFFF)rnrn If lX4 And lY4 Thenrn lResult = lResult Xor &H80000000 Xor lX8 Xor lY8rn ElseIf lX4 Or lY4 Thenrn If lResult And &H40000000 Thenrn lResult = lResult Xor &HC0000000 Xor lX8 Xor lY8rn Elsern lResult = lResult Xor &H40000000 Xor lX8 Xor lY8rn End Ifrn Elsern lResult = lResult Xor lX8 Xor lY8rn End Ifrnrn AddUnsigned = lResultrn End Functionrnrn Private Function md5_F(ByVal x, ByVal y, ByVal z)rn md5_F = (x And y) Or ((Not x) And z)rn End Functionrnrn Private Function md5_G(ByVal x, ByVal y, ByVal z)rn md5_G = (x And z) Or (y And (Not z))rn End Functionrnrn Private Function md5_H(ByVal x, ByVal y, ByVal z)rn md5_H = (x Xor y Xor z)rn End Functionrnrn Private Function md5_I(ByVal x, ByVal y, ByVal z)rn md5_I = (y Xor (x Or (Not z)))rn End Functionrnrn Private Sub md5_FF(ByVal a, ByVal b, ByVal c, ByVal d, ByVal x, ByVal s, ByVal ac)rn a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_F(b, c, d), x), ac))rn a = RotateLeft(a, s)rn a = AddUnsigned(a, b)rn End Subrnrn Private Sub md5_GG(ByVal a, ByVal b, ByVal c, ByVal d, ByVal x, ByVal s, ByVal ac)rn a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_G(b, c, d), x), ac))rn a = RotateLeft(a, s)rn a = AddUnsigned(a, b)rn End Subrnrn Private Sub md5_HH(ByVal a, ByVal b, ByVal c, ByVal d, ByVal x, ByVal s, ByVal ac)rn a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_H(b, c, d), x), ac))rn a = RotateLeft(a, s)rn a = AddUnsigned(a, b)rn End Subrnrn Private Sub md5_II(ByVal a, ByVal b, ByVal c, ByVal d, ByVal x, ByVal s, ByVal ac)rn a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_I(b, c, d), x), ac))rn a = RotateLeft(a, s)rn a = AddUnsigned(a, b)rn End Subrn
请帮忙,C#转VB.NET
protected bool SortAscending rn get rn object o = State["SortAscending"];rn if (o != null)rn return (bool)o;rn return true;rn rn set rn State["SortAscending"] = value;rn rn rnrnrn谢谢
VB.net转C#,ItemDataBound的问题
总是<em>提示</em>我出错:rnrn----------------------------------------------------------------------------------------rnrnif(e.Item.ItemType==ListItemType.AlternatingItem | e.Item.ItemType==ListItemType.Item)rn rn Label MessageCount;rn MessageCount=e.Item.FindControl("Label1");rn MessageCount.Text=System.Convert.ToInt32(MessageCount.Text);rn rnrn------------------------------------------------------------------------------------rnrnVB的就可以rnrn If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Thenrn Dim CountLable As Labelrn CountLable = e.Item.FindControl("MessageCount")rn CountLable.Text = CInt(CountLable.Text)rnrn End Ifrn
C#转VB.NET遇到的问题
代码是从csdn下载的,关于在.NET中如何解析JSON数据的,地址是:http://blog.csdn.net/zhoufoxcn/article/details/6254657rn然后我试着转成VB.NET,但总是<em>提示</em>各种错误,想请大家帮忙看看我转化的哪些地方有问题?中间一部分就没写了,定义属性那些都一样rn[code=vb]rnImports System.Runtime.SerializationrnImports Newtonsoft.JsonrnImports Newtonsoft.Json.LinqrnImports Newtonsoft.Json.ConvertersrnrnPublic Class Class2rn Public Function JsonConvertDemo()rn Dim user As User = New User() UserId = 1, UserName = "李刚", CreateDate = DateTime.Now.AddYears(-30), Birthday = DateTime.Now.AddYears(-50), Priority = Priority.BelowNormal, Salary = 5000rn 'JsonConvert类在Newtonsoft.Json.Net35.dll中,注意到http://www.codeplex.com/json/下载这个dll并添加这个引用rn 'JSON序列化rn Dim result As String = JsonConvert.SerializeObject(User)rn Console.WriteLine("使用JsonConvert序列化后的结果:0,长度:1", result, result.Length)rn 'JSON反序列化rn user = JsonConvert.DeserializeObject < user > (result)rn Console.WriteLine("使用JsonConvert反序列化后的结果:UserId:0,UserName:1,CreateDate:2,Priority:3", user.UserId, user.UserName, user.CreateDate, user.Priority)rn End Functionrnrn 'rn Public Class Userrn '' rn '' 编号rn '' rn Public Property UserId As Integerrn Getrnrn End Getrn Set(ByVal value As Integer)rnrn End Setrn End Propertyrn .........rn Public Sub User()rn Urls = New List(Of String)rn End Subrn End Classrn '' rn '' 权利级别rn '' rn Public Enum Priority As Bytern Lowest = 1rn BelowNormal = 2rn Normal = 4rn AboveNormal = 8rn Highest = 22rn End EnumrnEnd Classrn[/code]rn
vb.net 转换为 C# ,this 的用法
public class A 构造有如下代码:rnrn Public Sub New(ByVal owner As B)rn mOwner = ownerrn End Subrn rnpublic class B 中有如下代码:rnrn Private WithEvents _items As New A(Me)rnrnrn 请教各位以上代码如何修改为 C# 代码rn rn 我修改为 rn private A _items = new A(this);rn rn 编译时系统错误信息为 : 关键字在当前上下文中不可用rn rn 多谢,多谢。
VB.net转换为c#的工具
VB.net转换为<em>c#</em>的工具,自动识别错误,自动匹配变量类型,代码质量还不错
简单的VB.NET 转C# 求助
rn [code=VB.NET][align=left]Dim bOK As Booleanrnrn If bOK Thenrn bOK = MsgBox("发送成功", MsgBoxStyle.OKOnly, "复位控制卡")rn Elsern bOK = MsgBox("发送失败", MsgBoxStyle.OKOnly, "复位控制卡")rn End If[/align][/code]
VB.net 的 Redmin数组 转C#?
VB.net rnPublic Structure pSrcrn ...rnEnd StructurernrnPublic pSrcS() As pSrcrnrnPublic Function ... As pSrcrn ...rn Position = pSrcS.Lengthrn ReDim Preserve pSrcS(Position)rn ...rnEnd FunctionrnrnC#rnpublic struct pSrcrnrnrnpublic static pSrcS[] pSrc;rnrnpublic static pSrc ...rnrn ...rn //对应的Redmin 怎么写?rn ...rn
C# 转 VB.NET 谢谢了
把这段C#的代码转成VB.NET ,最好能详细的分析一下.谢谢大哥,大姐了!!!rnrnIntPtr dc1 = CreateDC ( "DISPLAY" , null , null , ( IntPtr ) null ) ;//创建显示器的DC rnGraphics g1 = Graphics.FromHdc ( dc1 ) ; //由一个指定设备的句柄创建一个新的Graphics对象rnBitmap myI;rnmyI = new Bitmap( Screen.PrimaryScreen.Bounds.Width ,Screen.PrimaryScreen.Bounds.Height , g1 ) ; rn//根据屏幕大小创建一个与之相同大小的Bitmap对象rnGraphics g2 = Graphics.FromImage ( myI ) ; //根据此位图创建一个和其一样的Graphic对象rnIntPtr dc3 = g1.GetHdc ( ) ;//获得位图的句柄 rnIntPtr dc2 = g2.GetHdc ( ) ; //把当前屏幕捕获到位图对象中 rnBitBlt ( dc2 , 0 , 0 , Screen.PrimaryScreen.Bounds.Width , Screen.PrimaryScreen.Bounds.Height , dc3 , 0 , 0 , 13369376 ) ; rng1.ReleaseHdc ( dc3 ) ; //释放屏幕句柄 rng2.ReleaseHdc ( dc2 ) ; //释放位图句柄 rnmyI.Save ( "c:\\MyJpeg.jpg") ;
C#转换为vb.net问题
namespace DocToolkitrnrn using StringList = List;rn using StringEnumerator = IEnumerator;rn public class MruManagerrn rn rn
VB.NET代码转换为c#
[color=#FF0000]VB.NET代码:[/color]rnrnPrivate Const PRINTER_NOTIFY_OPTIONS_REFRESH As Integer = &H1rnPublic dwFlags As Int32rnrn...rnrndwFlags dwFlags = dwFlags And (Not PRINTER_NOTIFY_OPTIONS_REFRESH)rnrn[color=#FF0000]如上VB.NET代码,按字面转换成<em>c#</em>代码为下面的:[/color]rnrn[color=#FF0000]C#代码:[/color]rnprivate const int PRINTER_NOTIFY_OPTIONS_REFRESH = 0x1;rnpublic int dwFlags = 0;rnrn...rnrndwFlags = dwFlags & (!PRINTER_NOTIFY_OPTIONS_REFRESH); rnrn但是因为!运算符在<em>c#</em>中是用于bool类型的操作,而PRINTER_NOTIFY_OPTIONS_REFRESH是整型的,所以不能编译通过.rn哪位大侠知道怎么转换<em>c#</em>代码呀?万分感谢!rn
vb.net转换到c#(请教)
我看dotnetnuke的代码时,看到以下代码:rnPublic Sub New(Optional ByVal name As String = Nothing, Optional ByVal paramType As SqlDbType = Nothing, Optional ByVal size As Integer = Nothing, Optional ByVal precision As Byte = Nothing, Optional ByVal scale As Byte = Nothing, Optional ByVal direction As ParameterDirection = Nothing)rn MyBase.New()rn _name = namern _paramType = paramTypern If paramType = Nothing Thenrn _paramTypeDefined = Falsern Elsern _paramTypeDefined = Truern End Ifrn _size = sizern _precision = precisionrn _scale = scalern _direction = directionrn If direction = Nothing Thenrn _directionDefined = Falsern Elsern _directionDefined = Truern End Ifrn End Sub 'Newrnrn问题:rnSqlDbType是枚举类型,在上面的vb代码中可以赋值为nothing并和nothing进行比较,但是,如果用在c#里,如果给paramType赋值为null,或将其与null比较,编译都通不过,如果这段代码改写,我该怎么办呢?rn
一句话的问题,C#转VB.net
LinkButton button = c as LinkButton;rn这句C#如何转换为<em>vb.net</em>代码,关键是个那个as....rn
求助 c#vb.net的一些问题
大家帮我看下这个转换,<em>vb.net</em>里多维数组溢出了,好像是初始化数组出问题了rn帮我改改,谢谢rn这是原来的<em>c#</em>代码rn[code=C#]rn int width = bitmap.PixelWidth;rn int height = bitmap.PixelHeight;rn int bands = 3;rn byte[][,] raster = new byte[bands][,];rnrn for (int i = 0; i < bands; i++)rn rn raster[i] = new byte[width, height];rn rnrn for (int row = 0; row < height; row++)rn rn for (int column = 0; column < width; column++)rn rn int pixel = bitmap.Pixels[width * row + column];rn raster[0][column, row] = (byte)(pixel >> 16);rn raster[1][column, row] = (byte)(pixel >> 8);rn raster[2][column, row] = (byte)pixel;rn rn [/code]rn我改成后的<em>vb.net</em>代码rn[code=VB.NET]Dim width As Integer = bitmap.PixelWidthrn Dim height As Integer = bitmap.PixelHeightrn Dim bands As Integer = 3rn Dim raster()(,) As Byte = New Byte(bands)(,) rn For i = 0 To bands - 1rn raster(i) = New Byte(width, height) rn Nextrn For row = 0 To (height - 1)rn For column = 0 To (width - 1)rn Dim pixel As Integer = bitmap.Pixels(width * row + column)rn raster(0)(column, row) = (pixel >> 16)rn raster(1)(column, row) = (pixel >> 8)rn raster(2)(column, row) = pixelrn Nextrn Next[/code]
this.defaultSku = this.Skus.Values.First()C#转vb.net
[code=csharp]this.defaultSku = this.Skus.Values.First()[/code]rn转<em>vb.net</em>rn[code=vb] Me.DefaultSku = Me.Skus.Values.First(Of SKUItem)()[/code]rnrn其中Skus定义rn[code=csharp]rn public Dictionary Skusrn rn getrn rn return (this.skus ?? (this.skus = new Dictionary()));rn rn rn[/code]
一个VB.Net转C#的问题
VB.net中如果定义Object对象如:Dim obj As Objectrn可以用如下方法obj.Value获取对象的Value,但C#没有Value这方法,怎么转成等价的语句呢?rn在线等~谢谢
一个C#转VB.net 的问题
[code=csharp][DllImport("DPSDK_Core.dll", CharSet = CharSet.Ansi)]rn private extern static IntPtr DPSDK_Create(dpsdk_sdk_type_e nType, ref IntPtr nPDLLHandle);[/code]rnrn这是C#的源码,我项转成VB.net,我是这样写的:rn[code=vb] rn Public Function DPSDK_Create(ByVal nType As dpsdk_sdk_type_e, ByRef nPDLLHandle As System.IntPtr) As System.IntPtrrn End Function[/code]rnrn其中 dpsdk_sdk_type_e我在后面进行了public enumrnrn我这种写法有问题吗?那个extern 和static我不知道该怎么加到<em>vb.net</em>里面,另外,如果论坛有人对C#和VB.net都比较熟悉的话,我想要请人帮我转一下,C#的工程Demo已经调试通过了,我想要转成VB.net。
C#代码转换为Vb.Net
C#代码转换为Vb.Net,不用我多说了吧?带有源代码和例程
vb.net转C# 高手帮忙
Dim enumString As String = PlayerTypeDropDown.SelectedItem.ToStringrnrn Dim playerType As TypeOfPlayer = CType(System.Enum.Parse(GetType(TypeOfPlayer), enumString), TypeOfPlayer)
VB.NET转ASP.NET(C#)问题
VB.NET代码:rnPrivate Function valipassword(ByVal passtext As String)rn Dim pass As String = "abcdefghijklmnopqrstuvwxyz1234567890"rn Dim ba As String = "0"rn Dim a As Integer = 0rn If Trim(passtext).Length = 16 Thenrn Return Falsern Exit Functionrn End Ifrn passtext = passtext.ToLowerrn For a = 0 To Trim(passtext).Length - 1rn ba = InStr(pass, passtext.Chars(a))rn If ba = "0" Thenrn Return Falsern Exit Functionrn End Ifrn Nextrn End Functionrn自己写的C#代码:rnpublic string valipassword(string passtext)rn rn string pass="abcdefghijklmnopqrstuvwxyz1234567890";rn string ba="0";rn int a=0;rn if (passtext.Length=16)rn rn return passtext="false";rn rn passtext=passtext.ToLower();rn for(a=0;a;rn rn rn rn编译出错:名称InStr在类或者命名空间中不存在;rn string 不包含多Chars的定义;
c#转c语言
菜鸟跪求大神:IPEndPoint( ,)、 UdpSendGps.Send()、 vs.PubMsg() C的对应函数或者能实现相同功能的库函数。急求!!!!
语言转换工具VB.net C#
安装在VS2008及以后版本里,即可进行VB.net和C#<em>语言</em>之间的相互转换。 视图=>其他窗口=>LanguageConvert
请问VB.NET和C#语言的区别?
rn【先放20分,完成后追加到100分】rnrn请详细说明。
C#转换成vb.net语言的问题
Excel.Application excel = new Excel.Application();rn excel.Application.Workbooks.Add(true);rn这两句转化成<em>vb.net</em>应该怎么写,谢谢
这段C#语言,对应的VB.net语言?
因为一直用的是VB,不会C#,所以..rnrnrnrnrnrn private void btnAdd_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e)rn rn string ID = null;rn foreach(DataListItem listItem in DataListNoCate.Items)rn rn System.Web.UI.Control control = listItem.FindControl("CheckNoCateItem");rn if(control is CheckBox)rn rn if( ((CheckBox)control).Checked )rn rn ID = ((Label)listItem.FindControl("LabNoCateSelectId")).Text;rn //JsClient.PopValue(LabNoCateSelectId1.Text);rn SqlHelp.ExecuteSql("Update selectedtitles set catelogId = "+Request.QueryString["CateId"]+" where id ="+ID);rn rn rn rn BindData();rn BindDataNoCate();rn
C#连接数据库,提示不支持关键字“data source”
[img=https://img-bbs.csdn.net/upload/201512/16/1450271329_522408.png][/img]rn这样显示的,rn调用的代码是上面的rn[img=https://img-bbs.csdn.net/upload/201512/16/1450271347_935625.png][/img]rnvs2010,sql2014
VbtoC#(VB语言转化为c#语言
VB<em>语言</em>转化为<em>c#</em><em>语言</em>,功能十分强大,注释也能转化·····················
C语言转换为C#
如题(这应该是C吧) 这段代码怎么翻译成 C#的啊 各位大虾帮帮小弟吧rnrnunsigned char * inkey;rn unsigned char key[64]; rnfor (i = 0; i < 8; i++) rn key[8*i] = ((j = *(inkey + i)) / 128) % 2;rn key[8*i+1] = (j / 64) % 2;rn key[8*i+2] = (j / 32) % 2;rn key[8*i+3] = (j / 16) % 2;rn key[8*i+4] = (j / 8) % 2;rn key[8*i+5] = (j / 4) % 2;rn key[8*i+6] = (j / 2) % 2;rn key[8*i+7] = j % 2;rn
C#语言转MaxScript语言简单示例
实现打开本地图片的方法: 1、MaxScript<em>语言</em>代码如下: fn nonLockingBitmapOpen fName = ( if not doesFileExist fName do return undefined local fs = dotnetObject "System.IO.FileStream" fName (dotnetClass "System.IO.FileM...
Timage提示不支持jpeg
工程中使用Image1->Picture->LoadFromFile(jpeg图片路径),语句一直正常,但是最近<em>提示</em>不支jpeg格式rn头文件中引加了#include ,静态也能加载jpeg图片,不知是什么原因rnrn新建一个工程,Image1->Picture->LoadFromFile(jpeg图片路径)语句也正常
提示不支持getElementsByClassName
[code=javascript] function validate() rn var trs = document.getElementsByClassName('trck'), cbs,ok;rn for (var i = 0; i < trs.length; i++) rn cbs = trs[i].getElementsByClassName('zwck');rn ok = false;rn for (var j = 0; j < cbs.length; j++) rn if (cbs[j].checked) ok = true; break;rn rn if (!ok) alert('第' + (i + 1) + '行至少要选择一项包装'); return false rn rn return true; rn [/code]rnrnrn<em>提示</em><em>不支持</em>getElementsByClassName
关闭 不支持的硬件 提示
关闭win7<em>不支持</em>的硬件的相关<em>提示</em>信息,关闭win7<em>不支持</em>的硬件的相关<em>提示</em>信息
请问谁有vb.net转换为c#c#转换为vb.net的工具(100相换)?
如题,谢谢大家了。
一个VB.NET语句转C#的问题
在<em>vb.net</em>中有这样一句: rnrn Public Function SaveChart() as string rn .... rn savechart = savechart + " " + cContent(2,i) + ":" + str(cContent(1,i)) rn .... rn End Function rnrn我不知道该如何翻译成C#的?我这样写可是不对: rnrn public string SaveChart() rn rn .... rn SaveChart=SaveChart+" "+cContent[2,i].ToString()+":"+cContent[1,i].ToString(); rn .... rn rnrn错误揭示:rnrn在不带括号的情况下引用了方法“Plarm_Test.chart.ChartColumn.SaveChart()” rnrn如果我加括号后:SaveChart()=SaveChart()+" "+cContent[2,i].ToString()+":"+cContent[1,i].ToString(); rnrnrn<em>提示</em>:赋值号左边必须是变量、属性或索引器 rnrnrnrn请指教,我对C#是一窍不通。
C#转VB.net ,看到奇怪的代码了。
谁帮我转一下,我自己转了N久都搞不掂。特别是Replace("\r\n"," \"+\r\n\"")和Replace("\"","\\\"");最头痛。。rnrnrnrnrnif(IsPostBack)rn rn string html=Codehighlighter1.Output.Replace("\"","\\\"");rn html=html.Replace("\r\n"," \"+\r\n\"");rn html=html.Replace("...","");rn rnrnrn string divstr=@" ";rn Response.Write(@"rn ");rn rn
代码转化(C#转换为Vb.net)
Button bFirst = new Button(); rnrn bFirst.Text = "测试按钮"; rnrn bFirst.Style["left"] = "150px"; rnrn bFirst.Style["top"] = "40px"; rnrn bFirst.Style["position"] = "absolute"; rnrn bFirst.ID = "tt"; rnrn [b] bFirst.Click = new EventHandler(bFirst_Click); ----------------主要这句不会转换[/b][color=#FF0000][/color]rnrn Page.Controls.Add(bFirst); rnrn
寻找vb.net转换为c#的工具,
寻找<em>vb.net</em>转换为<em>c#</em>的工具,
求助 C#代码转VB.NET代码
/// rn /// 判断图形里是否存在另外一个图形 并返回所在位置rn /// rn /// 原始图形rn /// 小图形rn /// 溶差rn /// 坐标rn public Point GetImageContains(Bitmap p_SourceBitmap, Bitmap p_PartBitmap, int p_Float)rn rn int _SourceWidth = p_SourceBitmap.Width;rn int _SourceHeight = p_SourceBitmap.Height;rn int _PartWidth = p_PartBitmap.Width;rn int _PartHeight = p_PartBitmap.Height;rn Bitmap _SourceBitmap = new Bitmap(_SourceWidth, _SourceHeight);rn Graphics _Graphics = Graphics.FromImage(_SourceBitmap);rn _Graphics.DrawImage(p_SourceBitmap, new Rectangle(0, 0, _SourceWidth, _SourceHeight));rn _Graphics.Dispose();rn BitmapData _SourceData = _SourceBitmap.LockBits(new Rectangle(0, 0, _SourceWidth, _SourceHeight), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);rn byte[] _SourceByte = new byte[_SourceData.Stride * _SourceHeight];rn Marshal.Copy(_SourceData.Scan0, _SourceByte, 0, _SourceByte.Length); //复制出p_SourceBitmap的相素信息rn _SourceBitmap.UnlockBits(_SourceData);rn Bitmap _PartBitmap = new Bitmap(_PartWidth, _PartHeight);rn _Graphics = Graphics.FromImage(_PartBitmap);rn _Graphics.DrawImage(p_PartBitmap, new Rectangle(0, 0, _PartWidth, _PartHeight));rn _Graphics.Dispose();rn BitmapData _PartData = _PartBitmap.LockBits(new Rectangle(0, 0, _PartWidth, _PartHeight), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);rn byte[] _PartByte = new byte[_PartData.Stride * _PartHeight];rn Marshal.Copy(_PartData.Scan0, _PartByte, 0, _PartByte.Length); //复制出p_PartBitmap的相素信息rn _PartBitmap.UnlockBits(_PartData);rn for (int i = 0; i != _SourceHeight; i++)rn rn if (_SourceHeight – i < _PartHeight) return new Point(-1, -1); //如果 剩余的高 比需要比较的高 还要小 就直接返回rn int _PointX = -1; //临时存放坐标 需要包正找到的是在一个X点上rn bool _SacnOver = true; //是否都比配的上rn for (int z = 0; z != _PartHeight – 1; z++) //循环目标进行比较rn rn int _TrueX = GetImageContains(_SourceByte, _PartByte, (i + z) * _SourceData.Stride, z * _PartData.Stride, _SourceWidth, _PartWidth, p_Float);rn if (_TrueX == -1) //如果没找到rn rn _PointX = -1; //设置坐标为没找到rn _SacnOver = false; //设置不进行返回rn break;rn rn elsern rn if (z == 0) _PointX = _TrueX;rn if (_PointX != _TrueX) //如果找到了 也的保证坐标和上一行的坐标一样 否则也返回rn rn _PointX = -1;//设置坐标为没找到rn _SacnOver = false; //设置不进行返回rn break;rn rn rn rn if (_SacnOver) return new Point(_PointX, i);rn rn return new Point(-1, -1);rn rn /// rn /// 判断图形里是否存在另外一个图形 所在行的索引rn /// rn /// 原始图形数据rn /// 小图形数据rn /// 开始位置rn /// 原始图形宽rn /// 小图宽rn /// 溶差rn /// 所在行的索引 如果找不到返回-1rn private int GetImageContains(byte[] p_Source, byte[] p_Part, int p_SourceIndex, int p_PartIndex, int p_SourceWidth, int p_PartWidth, int p_Float)rn rn int _PartIndex = p_PartIndex;//rn int _PartRVA = _PartIndex;//p_PartX轴起点rn int _SourceIndex = p_SourceIndex;//p_SourceX轴起点rn for (int i = 0; i < p_SourceWidth; i++)rn rn if (p_SourceWidth – i < p_PartWidth) return -1;rn Color _CurrentlyColor = Color.FromArgb((int)p_Source[_SourceIndex + 3], (int)p_Source[_SourceIndex + 2], (int)p_Source[_SourceIndex + 1], (int)p_Source[_SourceIndex]);rn Color _CompareColoe = Color.FromArgb((int)p_Part[_PartRVA + 3], (int)p_Part[_PartRVA + 2], (int)p_Part[_PartRVA + 1], (int)p_Part[_PartRVA]);rn _SourceIndex += 4;//成功,p_SourceX轴加4rn bool _ScanColor = ScanColor(_CurrentlyColor, _CompareColoe, p_Float);rn if (_ScanColor)rn rn _PartRVA += 4;//成功,p_PartX轴加4rn int _SourceRVA = _SourceIndex;rn bool _Equals = true;rn for (int z = 0; z != p_PartWidth – 1; z++)rn rn _CurrentlyColor = Color.FromArgb((int)p_Source[_SourceRVA + 3], (int)p_Source[_SourceRVA + 2], (int)p_Source[_SourceRVA + 1], (int)p_Source[_SourceRVA]);rn _CompareColoe = Color.FromArgb((int)p_Part[_PartRVA + 3], (int)p_Part[_PartRVA + 2], (int)p_Part[_PartRVA + 1], (int)p_Part[_PartRVA]);rn if (!ScanColor(_CurrentlyColor, _CompareColoe, p_Float))rn rn _PartRVA = _PartIndex;//失败,重置p_PartX轴开始rn _Equals = false;rn break;rn rn _PartRVA += 4;//成功,p_PartX轴加4rn _SourceRVA += 4;//成功,p_SourceX轴加4rn rn if (_Equals) return i;rn rn elsern rn _PartRVA = _PartIndex;//失败,重置p_PartX轴开始rn rn rn return -1;rn rn /// rn /// 检查色彩(可以根据这个更改比较方式rn /// rn /// 当前色彩rn /// 比较色彩rn /// 溶差rn /// rn private bool ScanColor(Color p_CurrentlyColor, Color p_CompareColor, int p_Float)rn rn int _R = p_CurrentlyColor.R;rn int _G = p_CurrentlyColor.G;rn int _B = p_CurrentlyColor.B;rn return (_R = p_CompareColor.R – p_Float) && (_G = p_CompareColor.G – p_Float) && (_B = p_CompareColor.B – p_Float);rn
C#代码转VB.NET代码错误
以下代码为C#代码rn[code=csharp]rn SqlConnection objconn = new SqlConnection();rn new DBConnMan1().opendb1(objconn);rn SqlCommand command = new SqlCommand(cmdText, objconn);rn SqlDataAdapter adapter = new SqlDataAdapterrn rn SelectCommand = commandrn ;rn this.ds = new DataSet();rn adapter.Fill(this.ds);rn objconn.Close();rn[/code]rnrn转换为VB.NET代码后,有错误,怎样修改:rn[img=http://www.jcb.net.cn/qq/QQ%E6%88%AA%E5%9B%BE20130330164958.png][/img]
c#代码转换为vb.net代码的问题。
请问如何将如下的<em>c#</em>代码转换为<em>vb.net</em>的代码呀?rnpublic class CCUtility rnrn protected HttpSessionState Session;rn protected HttpServerUtility Server;rn protected HttpRequest Request;rn protected HttpResponse Response;rnrn //构造函数,打开数据库连接rn public CCUtility(object parent)rn rn tryrn rn Session=((System.Web.UI.Page)parent).Session;rn Server=((System.Web.UI.Page)parent).Server;rn Request=((System.Web.UI.Page)parent).Request;rn Response=((System.Web.UI.Page)parent).Response;rn rn catchrn rn Session=((System.Web.UI.UserControl)parent).Session;rn Server=((System.Web.UI.UserControl)parent).Server;rn Request=((System.Web.UI.UserControl)parent).Request;rn Response=((System.Web.UI.UserControl)parent).Response;rn rn rn
求:VB.NET转换为C#的一段代码:(
Private Sub ItemDataBinding(ByVal sender As Object, ByVal e As EventArgs) rn Dim cell As TableCell = CType(sender, TableCell) rn Dim DGI As DataGridItem = CType(cell.NamingContainer, DataGridItem) rn Try rn cell.Text = DGI.DataItem(DataField) rn Catch RangeEx As IndexOutOfRangeException rn Throw New Exception("Specified DataField was not found.") rn Catch OtherEx As Exception rn Throw New Exception(OtherEx.InnerException.ToString) rn End Try rn End Sub rnrn注:Public DataField As String。rnrn关键是 rn cell.Text = DGI.DataItem(DataField)rn偶转换为rnrnDataGridItem DGI =(DataGridItem)cell.NamingContainer;rncell.Text =DGI.DataItem[DataField];rnrn时总报错~~:无法将带 [] 的索引应用于“object”类型的表达式rnrnrn
vb.net代码转换为c#代码,谢谢
rn想把下面的<em>vb.net</em>代码转换为<em>c#</em>代码,谢谢,在线等.rnrnrnSub SelPlay(strUrl,strWidth,StrHeight)rnDim Exts,isExtrnIf strUrl <> "" Thenrn isExt = LCase(Mid(strUrl,InStrRev(strUrl, ".")+1))rnElsern isExt = ""rnEnd IfrnExts = "avi,wmv,asf,mov,rm,ra,ram"rnIf Instr(Exts,isExt)=0 Thenrn Response.write "非法视频文件"rnElsern Select Case isExtrn Case "avi","wmv","asf","mov"rn Response.write ""rn Case "mov","rm","ra","ram"rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write " "rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn Response.Write ""rn End SelectrnEnd IfrnEnd Subrnrnrn
_________________c#转换为vb.net!谢谢各位前辈!
我在网上看了一段<em>c#</em>的代码,可是我只会一点点,<em>vb.net</em>,还请那位前辈有空帮我转换一下!谢谢!rn1)rnprotected void Application_AuthorizeRequest(object sender, System.EventArgs e)rnrn HttpApplication App = (HttpApplication) sender;rn HttpContext Ctx = App.Context ; //获取本次Http请求相关的HttpContext对象rn if (Ctx.Request.IsAuthenticated == true) //验证过的用户才进行role的处理rn rn FormsIdentity Id = (FormsIdentity)Ctx.User.Identity ;rn FormsAuthenticationTicket Ticket = Id.Ticket ; //取得身份验证票rn string[] Roles = Ticket.UserData.Split (',') ; //将身份验证票中的role数据转成字符串数组rn Ctx.User = new GenericPrincipal (Id, Roles) ; //将原有的Identity加上角色信息新建一个GenericPrincipal表示当前用户,这样当前用户就拥有了role信息rn rnrnrnrnrnrn2)rn Context.Response.Redirect (Context.Request["ReturnUrl"]) ; // 重定向到用户申请的初始页面rn 还请解释一下ReturnUrl是个什么参数呢?要怎么获取呢?rnrn谢谢各位前辈!
VB.NET项目转C#工具(带算号器)
可以将VB.net项目整体转换为C#的工具,转换率高!
VB.net、Delphi、VB6转C#工具及源代码
VB.net、Delphi、VB6转C#工具及源代码 程式是用VS 2003.net(C#)做的。截图如下 本文转载于 速特网 来源网址:http://www.sooot.cn/show/127.html
帮忙把 vb.net 转一下 c#
bool DisplayError = true; // Display Standard IE Script Error Dialog rn rn rn bool ContinueRunningScripts = true; // Continue to run Scripts rn rn rn HTMLDocumentClass Doc = (HTMLDocumentClass) pvaIn; rn rn rn IHTMLEventObj2 ev = (IHTMLEventObj2) Doc.parentWindow.@event; rn rn rn int errorLine = (int) ev.getAttribute("errorLine", 0); rn rn rn string errorCharacter = ev.getAttribute("errorCharacter", rn 0).ToString(); rn rn rn int errorCode = (int) ev.getAttribute("errorCode", 0); rn rn rn string errorMessage = (string) ev.getAttribute("errorMessage", 0); rn rn rn string errorUrl = (string) ev.getAttribute("errorUrl", 0); rn rn rn if(eScriptError != null) rn rn rn DisplayError = eScriptError(this, errorUrl, errorLine, rn errorMessage, out ContinueRunningScripts); rn rn rn // If were not displaying an error message then pause a moment rn rn rn if(!DisplayError) Sleep(2000); rn rn rn rn rn rn pvaOut = (System.Boolean) ContinueRunningScripts; rn rn rn throw new COMException("", (DisplayError ? S_ERROR : S_OK)); rnrnrn这里面前面都没有问题rn就是 if(eScriptError != null)中的这个eScriptError 在<em>c#</em>中是什么东西不知道
C# 语句 转 vb.net(关于事件)
请帮我转一下以下几个语句到 vb :rnrn //Create a recognition contextrn speechRecoContext = (SpInProcRecoContext)recognizer.CreateRecoContext();rnrn //Wire up events to handlersrn speechRecoContext.Hypothesis += new _ISpeechRecoContextEvents_HypothesisEventHandler(OnHypothesis);rn speechRecoContext.Recognition += new _ISpeechRecoContextEvents_RecognitionEventHandler(OnRecognition);rn speechRecoContext.EndStream += new _ISpeechRecoContextEvents_EndStreamEventHandler(OnAudioStreamEnd);rnrn
关于C#转VB.net的问题(急!!)
有如下代码:rn[code=C#]rn public event PrintPageDelegate PrintPagern rn addrn rn _printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(value);rn _printPageValue = value;rn rn removern rn _printDocument.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(value);rn _printPageValue = null;rn rn rn[/code]rn把它变换成VB.net代码如下:rn[code=VB.net#]rnrnPublic Custom Event PrintPage As PrintPageDelegate rn AddHandler(ByVal value As PrintPageDelegate) rn AddHandler _printDocument.PrintPage, AddressOf value rn _printPageValue = value rn End AddHandler rn RemoveHandler(ByVal value As PrintPageDelegate) rn RemoveHandler _printDocument.PrintPage, AddressOf value rn _printPageValue = Nothing rn End RemoveHandler rnEnd Event rn[/code]rnrn总是报错:rn错误 13 “AddressOf”操作数必须是某个方法的名称(不带圆括号)。rn错误 11 缺少事件“PrintPage”的“RaiseEvent”定义。rnrn请高手指点rnrnrnrnrnrnrn
sql执行问题,vb.netc# 的代码
[code=C#]rn command = new SqlCommand("exec('Select * From test Where id like @id)')", conn);rn command.Parameters.AddWithValue("id", "1,2,3");rn command.ExecuteNonQuery();rn[/code]rn总<em>提示</em>@id未定义rn同样的代码<em>vb.net</em>下没有任何错误,一切正为rn[code=VB.NET]rncommand = new SqlCommand("exec('Select * From test Where id like @id)')", conn)rn command.Parameters.AddWithValue("id", "1,2,3")rn command.ExecuteNonQuery()rn[/code]
VB.Net转换为C#,在线等待。。。
Private Sub socket_Closed(ByVal sender As Object, ByVal e Asrn System.EventArgs) Handles socket.Closedrn lCurrentState.Text = "Closed"rnEnd Subrnrn其中的Handles socket.Closed在C#中怎么表示啊??
C# 代码转换为 vb.net代码
各位高手,我这里有一段C#的代码,是将datatable 转换为泛型数据的,因为C#不是很熟,泛型也用的不多,不怎么看的懂,请看哪位可以帮忙将这堆代码转为<em>vb.net</em>,不胜感谢!rnrn[code=csharp]rnrn public class ModelHelperrn rnrn public static List DataTableToEntityList(DataTable dt)rn rn List entiyList = new List();rn Type entityType = typeof(T);rn PropertyInfo[] entityProperties = entityType.GetProperties();rn int index = 0;rn string str = "";rn foreach (DataRow row in dt.Rows)rn rnrn T entity = Activator.CreateInstance();rn foreach (PropertyInfo propInfo in entityProperties)rn rn if (dt.Columns.Contains(propInfo.Name))rn rn if (!row.IsNull(propInfo.Name))rn rn str = propInfo.Name;rn tryrn rn propInfo.SetValue(entity, row[propInfo.Name], null);rn rn catch (Exception e)rn rn throw new Exception(propInfo.Name + ":" + e.ToString());rn rn rn rn rn entiyList.Add(entity);rnrn index++;rn rn return entiyList;rn rn rnrn[/code]
将C#的代码转换为vb.net代码
C#中的代码Public VerticalScrollBar As New ScrollBar,转换为<em>vb.net</em>是什么呢?
高手看看VB.net转C#代码错误
以下是同一个过程的<em>vb.net</em>代码与<em>c#</em>代码,我几乎是逐句翻译的,但运行结果死活不一样,头痛死了。rnrn[code=vb] Private Function FolderNames(ByVal strDirect As String) As ArrayListrn Dim StrTemp As New ArrayListrn If Not (strDirect Is Nothing) Thenrn Debug.Print("**********************************")rn Debug.Print(strDirect)rnrn '遍历文件夹rn Dim mDirInfo As New System.IO.DirectoryInfo(strDirect)rn Dim mDir As System.IO.DirectoryInforn For Each mDir In mDirInfo.GetDirectoriesrn FolderNames(mDir.FullName)rn StrTemp.Add(mDir)rn Nextrn End Ifrn Return StrTemprn End Function[/code]rnrn[code=csharp] static ArrayList FolderNames(string strDirect)rn rn ArrayList StrTemp = new ArrayList();rn if (strDirect != null)rn rn Console.WriteLine("**********************************");rn Console.WriteLine("文件夹的路径:0", strDirect);rnrn //遍历文件夹rn DirectoryInfo mDirInfo =new DirectoryInfo(strDirect); rn foreach (DirectoryInfo mDir in mDirInfo.GetDirectories())rn rn FolderNames(mDir.FullName);rn StrTemp.Add(mDir);rn rnrn rn return StrTemp; rn [/code]rn请高手解疑,谢谢。
求好用的vb.netc#的工具
需要将一个<em>vb.net</em>写的代码转换成<em>c#</em>代码,因为时间不够,没有办法自己去转换了,请问大家有没有好的<em>vb.net</em>-><em>c#</em>的工具呢?rnrn谢谢!
c#vb.net 小问题 解决马上揭帖
public void PageSetup()rnrn PrinterPageSetting printerPageSetting; rn printerPageSetting = new PrinterPageSetting(mPrintDocument);rn rn printerPageSetting.PrintPage += new rn PrintPageDelegate (this.PrintPageEventHandler)rn rn printerPageSetting.PrintDocument = this.mPrintDocument;rn printerPageSetting.ShowPageSetupDialog();rnrn其中rnprinterPageSetting.PrintPage +=new PrintPageDelegate(this.PrintPageEventHandler);rn一句请转换为VB.NET代码rn下面一句是VB的,但是有问题:rnprinterPageSetting.PrintPage += New PrintPageDelegate(Me.PrintPageEventHandler)rnrn谢谢rn
求 C# 代码转 vb.net(VS2010)
一下是一个 C# sina股票接口 代码,我只会VB.net,求达人帮我转为VB.net,我在VB.net中使用,测试通过最好。rnrn rn// C# sina股票接口rn// 需要注意的这个只是获取单只股票rn// 代码的用处,通过这个代码有炒股的朋友就可以写出简单的自动止损和按一定价格入场的程序了。(国内正规券商<em>不支持</em>这种功能,可能是为了防止一些东西。)rn// 我们先来看一下股票信息的类rn rn namespace Qianfa.net.Library.Entityrnrn /*http://hq.sinajs.cn/list=sh600066 sh上海 sz深圳rn * 0:”大秦铁路”,股票名字;rn 1:”27.55″,今日开盘价;rn 2:”27.25″,昨日收盘价;rn 3:”26.91″,当前价格;//时间结束后也就是收盘价了rn 4:”27.55″,今日最高价;rn 5:”26.20″,今日最低价;rn 6:”26.91″,竞买价,即“买一”报价;rn 7:”26.92″,竞卖价,即“卖一”报价;rn 8:”22114263″,成交的股票数,由于股票交易以一百股为基本单位,所以在使用时,通常把该值除以一百;rn 9:”589824680″,成交金额,单位为“元”,为了一目了然,通常以“万元”为成交金额的单位,所以通常把该值除以一万;rn 10:”4695″,“买一”申请4695股,即47手;rn 11:”26.91″,“买一”报价;rn 12:”57590″,“买二”rn 13:”26.90″,“买二”rn 14:”14700″,“买三”rn 15:”26.89″,“买三”rn 16:”14300″,“买四”rn 17:”26.88″,“买四”rn 18:”15100″,“买五”rn 19:”26.87″,“买五”rn 20:”3100″,“卖一”申报3100股,即31手;rn 21:”26.92″,“卖一”报价rn (22, 23), (24, 25), (26,27), (28, 29)分别为“卖二”至“卖四的情况”rn 30:”2008-01-11″,日期;rn 31:”15:05:32″,时间;rn */rn public class StockInforn rn public string Namern rn get;rn set;rn rn rn public decimal TodayOpenrn rn get;rn set;rn rn rn public decimal YesterdayClosern rn get;rn set;rn rn rn public decimal Currentrn rn get;rn set;rn rn rn public decimal Highrn rn get;rn set;rn rn rn public decimal Lowrn get; set; rn rn /// rn /// 竟买价 买1rn /// rn public decimal Buyrn get; set; rn rn /// rn /// 竟卖价 卖1rn /// rn public decimal Sell get; set; rn rn /// rn /// 成交数 单位股数 通常除于100成为手rn /// rn public int VolAmount get; set; rn rn /// rn /// 成交多少钱,单位元rn /// rn public decimal VolMoney get; set; rn rn /// rn /// 新浪是可以看到5个,5档看盘 ,买1-买5rn /// rn public List BuyList get; set; rn rn /// rn /// 卖1-卖5rn /// rn public List SellList get; set; rn rn /// rn /// Date and Timern /// rn public DateTime Time get; set; rn rn public override string ToString()rn rn return Name + ": " + VolAmount + ":" + Current;rn rn rn rn rnrnrn rnnamespace Qianfa.net.Libraryrnrn rn///股票数据获取接口,你可以自己实现新浪yahoo...rn public interface IDataServicern rn StockInfo GetCurrent(string stockCode); rn rnrnrnnamespace Qianfa.net.DataServicesrnrn public class Sina : IDataServicern rn rn private const string dataurl = "http://hq.sinajs.cn/list=%7B0";rn #region IStockInfo Membersrn HttpClient client;rn private StockInfo PrevInfo;rn public StockInfo GetCurrent(string stockCode)rn rn tryrn rn if (client == null)rn rn client = new HttpClient();rn rn if (stockCode.Substring(0, 2) == "60")//上海是600打头rn rn stockCode = "sh" + stockCode;rn rn else if(stockCode.Substring(0,2)=="00")//深圳rn rn stockCode = "sz" + stockCode;rn rn else if (stockCode.Substring(0, 2) == "51")//上海基金rn rn stockCode = "sh" + stockCode;rn rn string url = string.Format(dataurl, stockCode);rn string data = client.DownloadString(string.Format(url, stockCode));rn PrevInfo = Parse(data);rn return PrevInfo;rn rn catchrn rn return PrevInfo;rn rn rn rn rn /// rn /// Parse Sina data to stock Inforn /// rn /// rn /// rn public static StockInfo Parse(string content)rn rn // var hq_str_sh600066 = "宇通客车,9.27,9.35,9.76,9.80,9.27,9.77,9.78,4567858,44306952,3100,9.77,1200,9.76,20500,9.75,1400,9.74,15300,9.73,10030,9.78,28093,9.79,156827,9.80,2800,9.81,6400,9.82,2009-01-09,15:03:32";rn int start = content.IndexOf('"')+1;rn int end = content.IndexOf('"',start);rn string input = content.Substring(start, end - start);rn string[] temp = input.Split(',');rn if (temp.Length != 32)rn rn return null;rn rn StockInfo info = new StockInfo();rn info.Name = temp[0];rn info.TodayOpen = decimal.Parse(temp[1]);rn info.YesterdayClose = decimal.Parse(temp[2]);rn info.Current = decimal.Parse(temp[3]);rn info.High = decimal.Parse(temp[4]);rn info.Low = decimal.Parse(temp[5]);rn info.Buy = decimal.Parse(temp[6]);rn info.Sell = decimal.Parse(temp[7]);rn info.VolAmount = int.Parse(temp[8]);rn info.VolMoney = decimal.Parse(temp[9]);rn info.BuyList = new List(5);rn int index = 10;rn for (int i = 0; i < 5; i++)rn rn GoodsInfo goods = new GoodsInfo();rn goods.State = GoodsState.Buy;rn goods.Amount = int.Parse(temp[index]);rn index++;rn goods.Price = decimal.Parse(temp[index]);rn index++;rn info.BuyList.Add(goods);rn rn info.SellList = new List(5);rn rn for (int i = 0; i < 5; i++)rn rn GoodsInfo goods = new GoodsInfo();rn goods.State = GoodsState.Sell;rn goods.Amount = int.Parse(temp[index]);rn index++;rn goods.Price = decimal.Parse(temp[index]);rn index++;rn info.SellList.Add(goods);rn rn info.Time = DateTime.Parse(temp[30] + " " + temp[31]);rn return info;rn rn rn rn #endregionrn rnrnrn rn public class GoodsInforn rn public int Amountrn get; set; rn public decimal Pricern rn get;rn set;rn rn public GoodsState State get; set; rn
C#代码转VB.net高手帮忙
C#源码 rn[code=csharp]rn private void LoadRichTextBoxData(RichTextBox txt, byte[] data)rnrn rn using (MemoryStream ms = new MemoryStream(data))rnrn rn using (GZipStream zip = new GZipStream(ms, CompressionMode.Decompress))rnrn rn using (MemoryStream ms2 = new MemoryStream())rnrn rn int b = -1;rnrn while ((b = zip.ReadByte()) != -1)rnrn rn ms2.WriteByte((byte)b);rn rnrn ms2.Position = 0;rnrn txt.LoadFile(ms2, RichTextBoxStreamType.RichText);rn rn rn rn rn[/code]rnrn以下是我自己从http://converter.telerik.com/ 转成的<em>vb.net</em>,会<em>提示</em>:[color=#FF0000]算术运算导致溢出[/color]rn[code=vb]rnrn Private Sub LoadRichTextBoxData(ByVal txt As RichTextBox, ByVal data As Byte())rn Using ms As MemoryStream = New MemoryStream(data)rn Using zip As GZipStream = New GZipStream(ms, CompressionMode.Decompress)rn Using ms2 As MemoryStream = New MemoryStream()rn Dim b As Integer = -1rn While (zip.ReadByte() <> -1)rn ms2.WriteByte(CByte(zip.ReadByte()))rn End Whilernrn ms2.Position = 0rn txt.LoadFile(ms2, RichTextBoxStreamType.RichText)rn End Usingrn End Usingrn End Usingrn End Subrn[/code]
c#代码转换为vb.net代码?
this.Load += new EventHandler(Page_Load);rn this.UpBtn.Click += new ImageClickEventHandler(UpBtn_Click);rn this.GoRoot.Click += new ImageClickEventHandler(GoRoot_Click);rn dgFSList.ItemDataBound += new DataGridItemEventHandler(dgFSList_ItemDataBound); rn dgFSList.ItemCommand += new DataGridCommandEventHandler(dgFSList_ItemCommand); rn dgFSList.PageIndexChanged +=new DataGridPageChangedEventHandler (dgFSList_PageChaged);rn this.UploadBtn.Click += new System.EventHandler(this.UploadBtn_Click);rn this.NewFolderBtn.Click += new System.EventHandler(this.NewFolderBtn_Click);
挖掘鸡7.1绿色版(最新最强版)下载
挖掘鸡7.1最新最强绿色版,挖掘鸡V7.1官方无壳版 相关下载链接:[url=//download.csdn.net/download/mmlego/3017233?utm_source=bbsseo]//download.csdn.net/download/mmlego/3017233?utm_source=bbsseo[/url]
ge fanuc rx3i产品培训下载
rx3i产品详细介绍 以及如何选型如何做配置 相关下载链接:[url=//download.csdn.net/download/xiaozhaofeibiao/3367940?utm_source=bbsseo]//download.csdn.net/download/xiaozhaofeibiao/3367940?utm_source=bbsseo[/url]
for_lupinxiu下载
为朋友做的一个动画,有兴趣的朋友可以下载看下 相关下载链接:[url=//download.csdn.net/download/qq_16166547/8442809?utm_source=bbsseo]//download.csdn.net/download/qq_16166547/8442809?utm_source=bbsseo[/url]
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数
我们是很有底线的