Click here to Skip to main content
15,921,351 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: how to format vb code nice? any key is available? Pin
Mycroft Holmes13-Apr-09 19:31
professionalMycroft Holmes13-Apr-09 19:31 
Questionhow to calculate the value for listView subitems? [modified] Pin
zhiyuan1613-Apr-09 15:49
zhiyuan1613-Apr-09 15:49 
AnswerRe: how to calculate the value for listView subitems? Pin
Mycroft Holmes13-Apr-09 19:32
professionalMycroft Holmes13-Apr-09 19:32 
GeneralRe: how to calculate the value for listView subitems? Pin
zhiyuan1613-Apr-09 19:41
zhiyuan1613-Apr-09 19:41 
Questionsave checked items in listview using savefiledialog Pin
siralphaomega13-Apr-09 6:54
siralphaomega13-Apr-09 6:54 
AnswerRe: save checked items in listview using savefiledialog Pin
Dave Kreskowiak13-Apr-09 10:38
mveDave Kreskowiak13-Apr-09 10:38 
GeneralRe: save checked items in listview using savefiledialog Pin
siralphaomega13-Apr-09 19:43
siralphaomega13-Apr-09 19:43 
GeneralRe: save checked items in listview using savefiledialog Pin
siralphaomega13-Apr-09 20:54
siralphaomega13-Apr-09 20:54 
Dave...I'm posting the entire code
Button1 works perfectly. I need help with Button2 to link checked items to the savefiledialog

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' button 1 searches for items
' get cache path from registry in case it has been moved...
Dim path As String = My.Computer.Registry.GetValue _
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Cache", Nothing)
If RadioButton1.Checked = True Then ' radio button 1 for *.swf
Me.ListView1.Items.Clear()
Dim fileSize As Integer = 0
Dim i As Integer ' counts items
i = 0
For Each foundFile As String In My.Computer.FileSystem.GetFiles(path, FileIO.SearchOption.SearchAllSubDirectories, "*.swf")
i = i + 1
fileSize = My.Computer.FileSystem.GetFileInfo(foundFile).Length
With ListView1.Items.Add(i) 'i is item number
.SubItems.Add(foundFile.Substring(foundFile.LastIndexOf("\") + 1)) ' Remove Path From Name
.SubItems.Add(FormatNumber(fileSize / 1024, 2, TriState.UseDefault)) ' convert to KB
.SubItems.Add(foundFile.ToString) ' path + filename
End With
Next foundFile
Label1.Text = "total =" & " " & i & " " & "items" ' displays total # of items
End If
''''''''''''''''
If RadioButton2.Checked = True Then ' radio button 2 for *.ico
Me.ListView1.Items.Clear()
Dim fileSize As Integer = 0
Dim i As Integer
i = 0
For Each foundFile As String In My.Computer.FileSystem.GetFiles(path, FileIO.SearchOption.SearchAllSubDirectories, "*.ico")
i = i + 1
fileSize = My.Computer.FileSystem.GetFileInfo(foundFile).Length
With ListView1.Items.Add(i)
.SubItems.Add(foundFile.Substring(foundFile.LastIndexOf("\") + 1)) ' Remove Path From Name
.SubItems.Add(FormatNumber(fileSize / 1024, 2, TriState.UseDefault))
.SubItems.Add(foundFile.ToString)
End With
Next foundFile
Label1.Text = "total =" & " " & i & " " & "items"
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' Open SaveFileDialog box
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

For Each checkeditem In ListView1.CheckedItems
My.Computer.FileSystem.CopyFile(SaveFileDialog1.FileNam, True)
Next
End If
End Sub
End Class
AnswerRe: save checked items in listview using savefiledialog Pin
Mycroft Holmes13-Apr-09 19:37
professionalMycroft Holmes13-Apr-09 19:37 
GeneralRe: save checked items in listview using savefiledialog Pin
siralphaomega13-Apr-09 20:56
siralphaomega13-Apr-09 20:56 
GeneralRe: save checked items in listview using savefiledialog Pin
Mycroft Holmes13-Apr-09 22:21
professionalMycroft Holmes13-Apr-09 22:21 
QuestionRegwrite Pin
siva45513-Apr-09 4:20
siva45513-Apr-09 4:20 
AnswerRe: Regwrite Pin
EliottA13-Apr-09 7:14
EliottA13-Apr-09 7:14 
AnswerRe: Regwrite Pin
Dave Kreskowiak13-Apr-09 8:43
mveDave Kreskowiak13-Apr-09 8:43 
AnswerRe: Regwrite Pin
Yusuf13-Apr-09 14:23
Yusuf13-Apr-09 14:23 
QuestionRun command Pin
p_196013-Apr-09 3:06
p_196013-Apr-09 3:06 
AnswerRe: Run command Pin
Dave Kreskowiak13-Apr-09 3:52
mveDave Kreskowiak13-Apr-09 3:52 
GeneralRe: Run command Pin
p_196013-Apr-09 4:16
p_196013-Apr-09 4:16 
QuestionRe: Run command Pin
Eddy Vluggen13-Apr-09 4:36
professionalEddy Vluggen13-Apr-09 4:36 
AnswerRe: Run command Pin
siva45513-Apr-09 5:15
siva45513-Apr-09 5:15 
GeneralRe: Run command Pin
Eddy Vluggen13-Apr-09 7:10
professionalEddy Vluggen13-Apr-09 7:10 
GeneralRe: Run command Pin
p_196013-Apr-09 9:11
p_196013-Apr-09 9:11 
GeneralRe: Run command Pin
EliottA13-Apr-09 9:34
EliottA13-Apr-09 9:34 
GeneralRe: Run command Pin
Eddy Vluggen13-Apr-09 10:01
professionalEddy Vluggen13-Apr-09 10:01 
GeneralRe: Run command Pin
Dave Kreskowiak13-Apr-09 10:36
mveDave Kreskowiak13-Apr-09 10:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.