深入浅出ASP.NET程序设计-源代码 书籍语言: 简体中文 书籍类型: 程序设计 授权方式: 免费软件 书籍大小: 627 KB

源代码在线查看: ch13-02-01.aspx

软件大小: 628 K
上传用户: bandagemaster
关键词: 书籍 ASP 627 NET
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
				
				Ch13-02-02.aspx 如何创建文件
				
				    Sub Button1_Click(Obj As Object, E As EventArgs)
				        If Trim(File1.Text) = "" then
				           Show1.InnerHTML = "请输入文件名称!"
				            Exit Sub
				       End If
				       Show1.InnerHtml = ""
				        Dim FileName As String = File1.Text
				        Dim Files As New FileInfo(FileName)
				        Dim blnRet As Boolean
				      blnRet = FileExists(Files, FileName)
				       If BlnRet = False Then 
				           Show1.InnerHTML = Show1.InnerHTML & "文件不存在,可以创建文件!"
				           CreateFile(Files, FileName)
				     Else
				          Show1.InnerHTML = Show1.InnerHTML & "文件已经存在,无法创建文件!"
				      End if 
				  End Sub
				  ' 检查文件是否存在
				   Function FileExists(Files As FileInfo, _
				               FileName As String) As Boolean
				        If Files.Exists Then
				            FileExists = True
				        Else
				             FileExists = False 
				         End if 
				      End Function
				     ' 创建文件
				    Sub CreateFile(Files As FileInfo, FileName As String)
				        Files = New FileInfo(FileName)
				        Dim Fs As FileStream = Files.Create()
				         Fs.Close()
				     End Sub
				
				 
				
				
				    文件名称:
				    				           Runat="Server" />
				    				           OnClick="Button1_Click" Runat="Server" />
				    				           BorderColor="#FF0000" Runat="Server" />
				
				
				
				
							

相关资源