Private Sub Command1_Click()
Dim gma00
Dim i, i1, h As Integer
Dim sA As String * 65400 '注释:声明定长String变量
Open "d:\123\落球码4.txt" For Binary As #1 '注释:用二进制打开文件
Get #1, , sA '注释:用Get语句从文件中获取字节
Text1 = sA '注释:显示打开的文件
Close #1 '注释:关闭文件
gma00 = Split(sA, ",")
n = UBound(gma00)
na = n / 11 - 9
For h = 0 To na
For i = h + 1 To 9 + h
For i1 = i * 11 To i * 11
yxa00 = Int(gma00(i1 - 11))
yxa01 = Int(gma00(i1 - 10))
yxa02 = Int(gma00(i1 - 9))
yxa03 = Int(gma00(i1 - 8))
yxa04 = Int(gma00(i1 - 7))
yxa05 = Int(gma00(i1 - 6))
yxa06 = Int(gma00(i1 - 5))
yxa07 = Int(gma00(i1 - 4))
yxa08 = Int(gma00(i1 - 3))
yxa09 = Int(gma00(i1 - 2))
yxa10 = Int(gma00(i1 - 1))
Debug.Print Format(yxa00, "00"); ","; Format(yxa01, "00"); ","; Format(yxa02, "00"); "," _
; Format(yxa03, "00"); ","; Format(yxa04, "00"); ","; Format(yxa05, "00"); "," _
; Format(yxa06, "00"); ","; Format(yxa07, "00"); ","; Format(yxa08, "00"); "," _
; Format(yxa09, "00"); ","; Format(yxa10, "00")
Next
Next
Next
End Sub
Dim gma00
Dim i, i1, h As Integer
Dim sA As String * 65400 '注释:声明定长String变量
Open "d:\123\落球码4.txt" For Binary As #1 '注释:用二进制打开文件
Get #1, , sA '注释:用Get语句从文件中获取字节
Text1 = sA '注释:显示打开的文件
Close #1 '注释:关闭文件
gma00 = Split(sA, ",")
n = UBound(gma00)
na = n / 11 - 9
For h = 0 To na
For i = h + 1 To 9 + h
For i1 = i * 11 To i * 11
yxa00 = Int(gma00(i1 - 11))
yxa01 = Int(gma00(i1 - 10))
yxa02 = Int(gma00(i1 - 9))
yxa03 = Int(gma00(i1 - 8))
yxa04 = Int(gma00(i1 - 7))
yxa05 = Int(gma00(i1 - 6))
yxa06 = Int(gma00(i1 - 5))
yxa07 = Int(gma00(i1 - 4))
yxa08 = Int(gma00(i1 - 3))
yxa09 = Int(gma00(i1 - 2))
yxa10 = Int(gma00(i1 - 1))
Debug.Print Format(yxa00, "00"); ","; Format(yxa01, "00"); ","; Format(yxa02, "00"); "," _
; Format(yxa03, "00"); ","; Format(yxa04, "00"); ","; Format(yxa05, "00"); "," _
; Format(yxa06, "00"); ","; Format(yxa07, "00"); ","; Format(yxa08, "00"); "," _
; Format(yxa09, "00"); ","; Format(yxa10, "00")
Next
Next
Next
End Sub
解决方案 »
- datagridview 单元格加提示
- list<T>与IList的几个问题
- 如何让Microsoft ReportViewer不经过显示预览而直接导出Excel??
- 求正则表达式!
- 使用Infragistics 控件的Quick Design 功能时提示“无法获取执行权限”,如何解决?
- 今天看到一个软件,它能在文本框中显示指数形式的文本内容,不知道它是怎么实现的
- 我在ASP。NET中将this.DataGrid1.BackColor = "#ff0814";怎么不对。怎么把"#ff0814"转化成颜色的格式啊
- 如何在c# form 中建立弹出式菜单
- 请教ARRAYLIST,ARRAY,HASHTABLE,SORTEDLIST相互间的区别和试用场合??
- exle 导入到datagridview 表出错?
- 求助:c#写的Ado.net访问数据库的问题,谢谢
- Sender, EventArgs e之类的参数是什么意思?
楼主看一下File, Stream(streamreader,streamwriter),string方面的资料应该就可自己解决了.
{
int []aa;
int i,i1,h;
}
如.txt
11,22,22,33,44,45,
12,23,22,22,55,43,
13,11,23,22,22,55,
14,12,33,55,44,33,
15,22,55,88,55,55,
16,22,55,22,45,44,
it failed to translate the code as i have tried
sorry, the tool doesnot work.
it failed to translate the code as i have tried
那是当然的了,它是VB代码,不能跟VB.NET代码相提并论!
//定义String
System.IO.StreamReader myReader = new System.IO.StreamReader(System.IO.File.OpenRead("C:\\1.txt"));
//定义Reader
temp=myReader.ReadToEnd();
//读到头
myReader.Close();
//关闭资源
this.richTextBox.Text=temp;
//显示在页面上
String[] strArray = temp.Replace(Environment.NewLine,"").Split(',');
int n=strArray.Length;
int na=n/11-9;
for(int h=0;h<na;h++)
//你给的数据不够,na成了负数
{
for(int i=h+1;i<9-h;i++)
{
for(int i1=i*11;i1<i*11;i1++)
//你的VB代码是不是写错逻辑了?这样子怎么做循环?
{
int int00=int.prase(strArray[i1-11]);
int int01=int.prase(strArray[i1-10]);
int int02=int.prase(strArray[i1-9]);
int int03=int.prase(strArray[i1-8]);
int int04=int.prase(strArray[i1-7]);
int int05=int.prase(strArray[i1-6]);
int int06=int.prase(strArray[i1-5]);
int int07=int.prase(strArray[i1-4]);
int int08=int.prase(strArray[i1-3]);
int int09=int.prase(strArray[i1-2]);
int int10=int.prase(strArray[i1-1]);
Console.WriteLine(int00.ToString("00") &
"," & int01.ToString("00") &
"," & int02.ToString("00") &
"," & int03.ToString("00") &
"," & int04.ToString("00") &
"," & int05.ToString("00") &
"," & int06.ToString("00") &
"," & int07.ToString("00") &
"," & int08.ToString("00") &
"," & int09.ToString("00") &
"," & int10.ToString("00"));
}
}
}
int na=n/11-9; 是每行11个数,上面的我写错了,
如.txt
11,22,22,33,44,45,1,2,3,9,5,
12,23,22,22,55,43,2,3,5,8,9,
13,11,23,22,22,55,5,2,5,6,8,
14,12,33,55,44,33,5,9,8,7,8,
15,22,55,88,55,55,5,6,8,6,8,
16,22,55,22,45,44,1,2,3,5,4,