快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

vb.net文件另存为 vb另存为程序怎么写

用vb.net编写写字板时怎么实现保存与另存为

可以用SaveFileDialog1对话框加上对文件数据操作的类来实现,,用richtextbox自己的属性方法也能行!我以前做过一个记事本程序就是那样的!

成都创新互联公司是一家专注于网站设计、网站制作与策划设计,汝南网站建设哪家好?成都创新互联公司做网站,专注于网站建设10多年,网设计领域的专业建站公司;建站业务涵盖:汝南等地区。汝南做网站价格咨询:18980820575

vb.net 保存excel弹出一个重命名对话框,另存为到其他盘

添加一个SaveFileDialog,在保存excle选择时候添加

SaveFileDialog1.show()

用法跟OpenFileDialog相同

VB.net怎样保存文件

保存文件的步骤为:

关闭流,特别是写入流

关闭并保存文件

示例代码如下:

Imports System.Windows.Forms

Imports System.IO

Imports System.Text

Sub SaveFileDemo()

'打开文件。如果文件不存在则创建新的文件

Dim myFile As New IO.FileStream("d:\data.txt", _

FileMode.OpenOrCreate, _

FileAccess.Write)

'在文件末尾添加一行 

Dim tw As New StreamWriter(myFile)

myFile.Seek(0, SeekOrigin.End)

tw.WriteLine("白刃格斗英雄连英模部队方队亮相阅兵")

'关闭流

tw.Close()

'关闭文件并保存文件

myFile.Close()

End Sub

vb.net中datagradview 另存为excel文件的问题

Public Class Cls导入数据

Dim xlApp As New Excel.Application()

Dim xlBook As Excel.Workbook

Dim xlSheet As Excel.Worksheet

Dim A = "A"

Public Function 导出到Excel(ByVal Dt表 As DataTable) As Boolean

Dim rowIndex, colIndex As Integer

rowIndex = 1

colIndex = 0

xlBook = xlApp.Workbooks().Add

xlSheet = xlBook.Worksheets("sheet1")

Dim Table As New DataTable()

Table = CreaTable()

'将所得到的表的列名,赋值给单元格

Dim Col As DataColumn

Dim Row As DataRow

For Each Col In Table.Columns

colIndex = colIndex + 1

xlApp.Cells(1, colIndex) = Col.ColumnName

Next

'得到的表所有行,赋值给单元格

For Each Row In Table.Rows

rowIndex = rowIndex + 1

colIndex = 0

For Each Col In Table.Columns

colIndex = colIndex + 1

xlApp.Cells(rowIndex, colIndex) = Row(Col.ColumnName)

Next

Next

With xlSheet

.Range(.Cells(1, 1), .Cells(1, colIndex)).Font.Name = "黑体"

'设标题为黑体字

.Range(.Cells(1, 1), .Cells(1, colIndex)).Font.Bold = True

'标题字体加粗

.Range(.Cells(1, 1), .Cells(rowIndex, colIndex)).Borders.LineStyle = 1

'设表格边框样式

End With

With xlSheet.PageSetup

.LeftHeader = "" Chr(10) """楷体_GB2312,常规""10公司名称:" ' Gsmc

.CenterHeader = """楷体_GB2312,常规""公司人员情况表""宋体,常规""" Chr(10) """楷体_GB2312,常规""10日 期:"

.RightHeader = "" Chr(10) """楷体_GB2312,常规""10单位:"

.LeftFooter = """楷体_GB2312,常规""10制表人:"

.CenterFooter = """楷体_GB2312,常规""10制表日期:"

.RightFooter = """楷体_GB2312,常规""10第P页 共N页"

End With

xlApp.SaveWorkspace()

MsgBox("保存完毕", MsgBoxStyle.Exclamation, "提示")

KillAllExcels()

'xlApp.Visible = True

End Function

Sub KillAllExcels()

Dim proc As System.Diagnostics.Process

For Each proc In System.Diagnostics.Process.GetProcessesByName("EXCEL")

proc.Kill()

Next

End Sub

end class


网页题目:vb.net文件另存为 vb另存为程序怎么写
网站网址:http://6mz.cn/article/doicssd.html

其他资讯