求救VB和C#都通的高手!!!这行代码没转成功!!
VB代码:
Loop Until k = 3 Or UBound(datavalue) > 11
机器人转过来的C#代码:
while (!(k == 3 | Information.UBound(datavalue) > 11));
问题是:调试的时候出现““UBound”方法没有采用“1个参数重载””.鼠标放在““UBound”上出现的提示是《int.Information.UBound
(Array Array, int Rank)返回可用于数组的制定维数最大下标》
请问UBound的另一个参数是什么??这段代码该C#怎么写..
请高手帮忙给点思路 万分感激!!!
datavalue是个数组?
while(k!=3&&datavalue.Length <=11)
ok了
有个问题要解决,c#里数组不可变长,
你可能要把数组换成List或者ArrayList
需要引用 Microsoft.VisualBasic.dll 并且在代码中 using Microsoft.VisualBasic,这样就找到了 Information 类。
datavalue放入ArrayList实例中
如果第二个参数不能缺省,就手动填上吧。
C# code:
public static int UBound(Array Array, [Optional, DefaultParameterValue(1)] int Rank)
{
if (Array == null)
{
throw ExceptionUtils.VbMakeException(new ArgumentNullException(Utils.GetResourceString("Argument_InvalidNullValue1", new string[] { "Array" })), 9);
}
if ((Rank < 1) || (Rank > Array.Rank))
{
throw new RankException(Utils.GetResourceString("Argument_InvalidRank1", new string[] { "Rank" }));
相关问答:
//C 接口
extern "C"
{
TESSDLL_API int __cdecl GetTessText(const char *imagefile, char *text);
}
//我在C#中声明
//调用C DLL 中的函数
[DllImport("OCRapi.dll&quo ......
请教一下:我用vb写了一个调用Illustrator的测试程序,代码很简单:Private Sub Command1_Click()
Dim app As New Illustrator.Application
Dim doc As Illustrator.Document
Dim thislayer As Illustrator.Layer ......
vb将winsock控件封装到dll问题 有什么好的思路? 如果用Socket API呢?
例如,像下面这样封装Winsock控件,行的通?
创建ActiveX dll,添加窗体frmClient,加入WinSock控件wskClient。
类代码:
Option Expli ......
Private Sub Check1_Click()
If Check1.Value = 1 Then
DTP1.Enabled = True
Else
DTP1.Enabled = False
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
DTP2.Enabled = True
Else
......