2014年3月8日 星期六
introduction 簡報系統
--------
introduction 簡報系統(單機版)
■簡報系統(單機版)安裝程式 v 1.0.0 【下載】 試用帳號/密碼:0000
■作業系統必須安裝 【framework 3.5 sp1或以上】
■作業系統支援 【WinXP,Win7,Win8】等作業系統
■試用版:限1筆簡報資料
■簡報系統支援線上更新,請善加利用功能[檢查版本]即可自動偵測最新版本並自動更新
運用行業等簡報:
醫美.汽車.髮廊.婚沙.服飾.場合式表演...等等須圖片式說明產品的報告或是客人自行瀏覽產品等!
簡報系統並非一般的圖文檔模式,主要為管理圖(照)片等;運用資料庫管理層面來達到方便管理和對客戶的簡介說明產品等呈現方式!
若想對照片管理,也可以使用! 此產品就看怎運用及發揮應用!
歡迎下載試用!
vbnet Download File Asynchronously With ProgressBar (正確沒問題版)
參考引用
--
--
Private Sub btnStartDownload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartDownload.Click
Dim client As WebClient = New WebClient
AddHandler client.DownloadProgressChanged, AddressOf client_ProgressChanged
AddHandler client.DownloadFileCompleted, AddressOf client_DownloadCompleted
client.DownloadFileAsync(New Uri("SomeURL"), "SomePlaceOnHardDrive")
btnStartDownload.Text = "Download in Progress"
btnStartDownload.Enabled = False
End Sub
Private Sub client_ProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs)
Dim bytesIn As Double = Double.Parse(e.BytesReceived.ToString())
Dim totalBytes As Double = Double.Parse(e.TotalBytesToReceive.ToString())
Dim percentage As Double = bytesIn / totalBytes * 100
progressBar.Value = Int32.Parse(Math.Truncate(percentage).ToString())
End Sub
Private Sub client_DownloadCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
MessageBox.Show("Download Complete")
btnStartDownload.Text = "Start Download"
btnStartDownload.Enabled = True
End Sub
vbnet Net.WebClient downfile
引用來源#1
--
Public Class Form1
Friend WithEvents MyWebClient As New Net.WebClient
Private Sub MyWebClient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles MyWebClient.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MyWebClient.DownloadFileAsync(New Uri("http://myweb.com/myfile.zip"), "C:\myfile.zip")
End Sub
End Class
參考引用來源#2
--
Dim wc As System.Net.WebClient
Private Sub btnButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnButton1.Click
wc = New System.Net.WebClient()
AddHandler wc.DownloadProgressChanged, AddressOf OnDownloadProgressChanged
AddHandler wc.DownloadFileCompleted, AddressOf OnFileDownloadCompleted
wc.DownloadFileAsync(New Uri("http://url.com/file.zip";), "C:\Downloads\file.zip")
End Sub
Private Sub OnDownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs)
Dim totalSize As Long = e.TotalBytesToReceive
Dim downloadedBytes As Long = e.BytesReceived
Dim percentage As Integer = e.ProgressPercentage
'Put your progress UI here, you can cancel download by uncommenting the line below
'wc.CancelAsync()
End Sub
Private Sub OnFileDownloadCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
If e.Cancelled Then
'Cancelled
ElseIf Not e.Error Is Nothing Then
'Error occured
Else
'File Downloaded Successfuly
End If
End Sub
引用來源#3
--
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim wClient As New WebClient
AddHandler wClient.DownloadProgressChanged, AddressOf DownloadProgressChanged
AddHandler wClient.DownloadStringCompleted, AddressOf DownloadStringCompleted
wClient.DownloadStringAsync(New Uri(TextBox1.Text))
End Sub
Private Sub DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs)
ProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub DownloadStringCompleted(ByVal sender As Object, ByVal e As DownloadStringCompletedEventArgs)
Dim wClient As WebClient = DirectCast(sender, WebClient)
RemoveHandler wClient.DownloadProgressChanged, AddressOf DownloadProgressChanged
RemoveHandler wClient.DownloadStringCompleted, AddressOf DownloadStringCompleted
ProgressBar1.Value = 0
If e.Error IsNot Nothing Then
MessageBox.Show(e.Error.Message)
ElseIf e.Cancelled Then
MessageBox.Show("Download cancelled by the user")
Else
' e.Result contains the downloaded string.
MessageBox.Show(e.Result)
End If
End Sub
--
Public Class Form1
Friend WithEvents MyWebClient As New Net.WebClient
Private Sub MyWebClient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles MyWebClient.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MyWebClient.DownloadFileAsync(New Uri("http://myweb.com/myfile.zip"), "C:\myfile.zip")
End Sub
End Class
參考引用來源#2
--
Dim wc As System.Net.WebClient
Private Sub btnButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnButton1.Click
wc = New System.Net.WebClient()
AddHandler wc.DownloadProgressChanged, AddressOf OnDownloadProgressChanged
AddHandler wc.DownloadFileCompleted, AddressOf OnFileDownloadCompleted
wc.DownloadFileAsync(New Uri("http://url.com/file.zip";), "C:\Downloads\file.zip")
End Sub
Private Sub OnDownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs)
Dim totalSize As Long = e.TotalBytesToReceive
Dim downloadedBytes As Long = e.BytesReceived
Dim percentage As Integer = e.ProgressPercentage
'Put your progress UI here, you can cancel download by uncommenting the line below
'wc.CancelAsync()
End Sub
Private Sub OnFileDownloadCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
If e.Cancelled Then
'Cancelled
ElseIf Not e.Error Is Nothing Then
'Error occured
Else
'File Downloaded Successfuly
End If
End Sub
引用來源#3
--
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim wClient As New WebClient
AddHandler wClient.DownloadProgressChanged, AddressOf DownloadProgressChanged
AddHandler wClient.DownloadStringCompleted, AddressOf DownloadStringCompleted
wClient.DownloadStringAsync(New Uri(TextBox1.Text))
End Sub
Private Sub DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs)
ProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub DownloadStringCompleted(ByVal sender As Object, ByVal e As DownloadStringCompletedEventArgs)
Dim wClient As WebClient = DirectCast(sender, WebClient)
RemoveHandler wClient.DownloadProgressChanged, AddressOf DownloadProgressChanged
RemoveHandler wClient.DownloadStringCompleted, AddressOf DownloadStringCompleted
ProgressBar1.Value = 0
If e.Error IsNot Nothing Then
MessageBox.Show(e.Error.Message)
ElseIf e.Cancelled Then
MessageBox.Show("Download cancelled by the user")
Else
' e.Result contains the downloaded string.
MessageBox.Show(e.Result)
End If
End Sub
偵測 My.Computer.Network.DownloadFile 被中斷
引用來源
請參考:Download and Upload using VB.NET
--
Dim FilenameMP3 As String = "http://ap.a168a.com/test/您要下載的位址檔名"
Dim SaveLocation As String = "d:\001test.zip" '要存放的檔案位置
Try
My.Computer.Network.DownloadFile(FilenameMP3, SaveLocation, "", "", True, 8000, True, FileIO.UICancelOption.ThrowException)
Catch ex As System.OperationCanceledException
MsgBox("下載被取消")
End Try
請參考:Download and Upload using VB.NET
--
Dim FilenameMP3 As String = "http://ap.a168a.com/test/您要下載的位址檔名"
Dim SaveLocation As String = "d:\001test.zip" '要存放的檔案位置
Try
My.Computer.Network.DownloadFile(FilenameMP3, SaveLocation, "", "", True, 8000, True, FileIO.UICancelOption.ThrowException)
Catch ex As System.OperationCanceledException
MsgBox("下載被取消")
End Try
如何使用VB.net下載網路上的檔案.
引用來源
--
本文使用VB.net 2005 Express進行下載:
下載的方式有二:
(一)使用System.Net.WebClien下載,
範例如下:
Dim 網址 as String = "Http://yahoo.com.tw/a.jpg"
Dim 存檔路徑 as String = "C:\"
Dim 存檔檔名 as String = "a.jpg"
Dim strFilePath As String = 存檔路徑 + "\" + 存檔檔名
Dim dwl As New System.Net.WebClient()
dwl.DownloadFile(網址, strFilePath)
dwl.Dispose()
(二)使用My.Computer.Network.DownloadFile下載*:
語法如下:
My.Computer.Network.DownloadFile(address, destinationFileName, username, password, showUI,connectionTimeout, overwrite)
範例:
My.Computer.Network.DownloadFile("http://192.168.1.1/download.ini", "C:\Program Files\download.ini", "", "", True, 500, True)
--
本文使用VB.net 2005 Express進行下載:
下載的方式有二:
(一)使用System.Net.WebClien下載,
範例如下:
Dim 網址 as String = "Http://yahoo.com.tw/a.jpg"
Dim 存檔路徑 as String = "C:\"
Dim 存檔檔名 as String = "a.jpg"
Dim strFilePath As String = 存檔路徑 + "\" + 存檔檔名
Dim dwl As New System.Net.WebClient()
dwl.DownloadFile(網址, strFilePath)
dwl.Dispose()
(二)使用My.Computer.Network.DownloadFile下載*:
語法如下:
My.Computer.Network.DownloadFile(address, destinationFileName, username, password, showUI,connectionTimeout, overwrite)
範例:
My.Computer.Network.DownloadFile("http://192.168.1.1/download.ini", "C:\Program Files\download.ini", "", "", True, 500, True)
2014年3月6日 星期四
DATATABLE和XML互相转换
參考引用來源
--
'''
''' DATATABLE转为XML格式的字符串
'''
'''
'''
'''
Private Function CreateXmlToString(ByVal dt As DataTable) As String
Dim settings As New XmlWriterSettings
settings.Indent = True
settings.NewLineOnAttributes = True
Dim strxml As New StringBuilder()
Dim writer As XmlWriter = XmlWriter.Create(strxml, settings)
Try
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
writer.WriteStartDocument()
writer.WriteStartElement("expenditure")
writer.WriteStartElement("FYDATA")
writer.WriteAttributeString("name", "费用明细字符串")
For i As Integer = 0 To dt.Rows.Count - 1
writer.WriteStartElement("item")
writer.WriteAttributeString("CustomerID", dt.Rows(i).Item("CustomerID"))
writer.WriteAttributeString("CompanyName", dt.Rows(i).Item("CompanyName"))
writer.WriteAttributeString("ContactName", dt.Rows(i).Item("ContactName"))
writer.WriteAttributeString("ContactTitle", dt.Rows(i).Item("ContactTitle"))
writer.WriteAttributeString("Address", dt.Rows(i).Item("Address"))
writer.WriteEndElement()
Next
writer.WriteEndElement()
writer.WriteEndElement()
writer.WriteEndDocument()
writer.Flush()
writer.Close()
End If
Catch ex As Exception
Throw ex
End Try
Return strxml.ToString()
End Function
'''
''' XML格式的字符串转为DATASET
'''
'''
'''
'''
Private Function DataToXml(ByVal strxml As String) As DataSet
Dim result As New DataSet
Try
If strxml.Trim.Length > 0 Then
'读取成流文件
Dim stream As StringReader = New StringReader(strxml)
'对xml流文件的只进只读访问
Dim xread As XmlTextReader = New XmlTextReader(stream)
'把数据读入DATASET中
result.ReadXml(xread)
End If
Catch ex As Exception
Throw ex
End Try
Return result
End Function
--
'''
''' DATATABLE转为XML格式的字符串
'''
'''
'''
'''
Private Function CreateXmlToString(ByVal dt As DataTable) As String
Dim settings As New XmlWriterSettings
settings.Indent = True
settings.NewLineOnAttributes = True
Dim strxml As New StringBuilder()
Dim writer As XmlWriter = XmlWriter.Create(strxml, settings)
Try
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
writer.WriteStartDocument()
writer.WriteStartElement("expenditure")
writer.WriteStartElement("FYDATA")
writer.WriteAttributeString("name", "费用明细字符串")
For i As Integer = 0 To dt.Rows.Count - 1
writer.WriteStartElement("item")
writer.WriteAttributeString("CustomerID", dt.Rows(i).Item("CustomerID"))
writer.WriteAttributeString("CompanyName", dt.Rows(i).Item("CompanyName"))
writer.WriteAttributeString("ContactName", dt.Rows(i).Item("ContactName"))
writer.WriteAttributeString("ContactTitle", dt.Rows(i).Item("ContactTitle"))
writer.WriteAttributeString("Address", dt.Rows(i).Item("Address"))
writer.WriteEndElement()
Next
writer.WriteEndElement()
writer.WriteEndElement()
writer.WriteEndDocument()
writer.Flush()
writer.Close()
End If
Catch ex As Exception
Throw ex
End Try
Return strxml.ToString()
End Function
'''
''' XML格式的字符串转为DATASET
'''
'''
'''
'''
Private Function DataToXml(ByVal strxml As String) As DataSet
Dim result As New DataSet
Try
If strxml.Trim.Length > 0 Then
'读取成流文件
Dim stream As StringReader = New StringReader(strxml)
'对xml流文件的只进只读访问
Dim xread As XmlTextReader = New XmlTextReader(stream)
'把数据读入DATASET中
result.ReadXml(xread)
End If
Catch ex As Exception
Throw ex
End Try
Return result
End Function
2014年3月4日 星期二
vb net xsd dataset
MSDN:從 XML 載入 DataSet 結構描述資訊
MSDN:將 DataSet 結構描述資訊寫為 XSD
MSDN:將 DataSet 內容撰寫成 XML 資料
--
(1)XML(XSD) 載入 dataset
Dim dataSet As DataSet = New DataSet
dataSet.ReadXmlSchema("schema.xsd")
Dim xmlStream As System.IO.StreamReader = New System.IO.StreamReader ("schema.xsd");
Dim dataSet As DataSet = New DataSet
dataSet.ReadXmlSchema(xmlStream)
xmlStream.Close()
(2)dataset 寫入 XSD (XML)
dataSet.WriteXmlSchema("Customers.xsd")
Dim writer As System.IO.StreamWriter = New System.IO.StreamWriter("Customers.xsd")
dataSet.WriteXmlSchema(writer)
writer.Close()
Dim schemaString As String = dataSet.GetXmlSchema()
(3)將 DataSet 內容撰寫成 XML 資料
Dim xmlSW As System.IO.StreamWriter = New System.IO.StreamWriter("Customers.xml")
custDS.WriteXml(xmlSW, XmlWriteMode.WriteSchema)
xmlSW.Close()
MSDN:將 DataSet 結構描述資訊寫為 XSD
MSDN:將 DataSet 內容撰寫成 XML 資料
--
(1)XML(XSD) 載入 dataset
Dim dataSet As DataSet = New DataSet
dataSet.ReadXmlSchema("schema.xsd")
Dim xmlStream As System.IO.StreamReader = New System.IO.StreamReader ("schema.xsd");
Dim dataSet As DataSet = New DataSet
dataSet.ReadXmlSchema(xmlStream)
xmlStream.Close()
(2)dataset 寫入 XSD (XML)
dataSet.WriteXmlSchema("Customers.xsd")
Dim writer As System.IO.StreamWriter = New System.IO.StreamWriter("Customers.xsd")
dataSet.WriteXmlSchema(writer)
writer.Close()
Dim schemaString As String = dataSet.GetXmlSchema()
(3)將 DataSet 內容撰寫成 XML 資料
Dim xmlSW As System.IO.StreamWriter = New System.IO.StreamWriter("Customers.xml")
custDS.WriteXml(xmlSW, XmlWriteMode.WriteSchema)
xmlSW.Close()
vbnet DataGridView 檢查 NULL
參考引用來源
--
If Not IsDBNull(gv.Rows(i).Cells(1).Value) AndAlso gv.Rows(i).Cells(1).Value.ToString.Length <> 0 Then
' YourCode
End If
--
If Not IsDBNull(gv.Rows(i).Cells(1).Value) AndAlso gv.Rows(i).Cells(1).Value.ToString.Length <> 0 Then
' YourCode
End If
訂閱:
文章 (Atom)
