毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> net技术 >> 正文

能把C#给弄成VB.NET吗

更新时间:2012-9-25:  来源:毕业论文

1,WebRequest和WebResponse

WebRequest request = WebRequest.Create("http-://images.cnblogs.-com/logo_small.gif"); 
WebResponse response = request.GetResponse(); 
Stream reader = response.GetResponseStream(); 
FileStream writer = new FileStream("x:\\pic.jpg", FileMode.OpenOrCreate, FileAccess.Write);
byte[] buff = new byte[512]; 
int c = 0; //实际读取的字节数 
while ((c=reader.Read(buff, 0, buff.Length)) > 0)
 {  
writer.Write(buff, 0, c); 
}
 writer.Close();
 writer.Dispose(); 
reader.Close();
 reader.Dispose();
 response.Close();


希望给改成VB.NET
 
WebRequest request = WebRequest.Create("http:-//images.cnblogs.-com/logo_small.gif")
Dim response As WebResponse = request.GetResponse()
Dim reader As Stream = response.GetResponseStream()
Dim writer As New FileStream("x:\pic.jpg", FileMode.OpenOrCreate, FileAccess.Write)
Dim buff(511) As Byte
Dim c As Integer = 0 '实际读取的字节数
c=reader.Read(buff, 0, buff.Length)
Do While c > 0
writer.Write(buff, 0, c)
    c=reader.Read(buff, 0, buff.Length)
Loop
 writer.Close()
 writer.Dispose()
reader.Close()
 reader.Dispose()
 response.Close()

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。