Dim Command As String Command = "ipconfig /all" Shell("cmd /k" & Command, 1, True)
Many thanks worked a treat
Dim Command As String Command = "ipconfig /all" Shell("cmd /k" & Command, 1, True)
Many thanks worked a treat
Hi im trying to run "ipconfig /all" in vb this is the code i have but the window closes down after it has completed the command is there away to keep the window active until the user wants to close it?
Dim Command As String
Command = "ipconfig /all"
Shell("cmd /c" & Command, 1, True)
Thanks
Bagleys
This is what iv got but i don't know how to use it within this code to delete the file.
Dim FILE_NAME1 As String = "h:\Documents and Settings\bagleys\pwconns.log"
If CheckBox5.Checked = False Then
ElseIf System.IO.File.Exists(FILE_NAME1) = True Then
Try
My.Computer.FileSystem.DeleteFile(FILE_NAME1)
Label8.Text = "Deleted"
Label8.ForeColor = Color.Blue
Catch
MessageBox.Show("Unable to DELETE.", "Error")
End Try
You should let the Win32 API look that up for you:
Dim dir As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
Hi
That coding is exactly what I'm looking for but Ive tried using it and playing around with it but i cant get it to work with what i want it to do. To be honest i don't have a clue how to implement it into my code so that i can check a file exist and then be able to delete it. Please help.
Bagleys
Hi
Thank you so much i will give it ago, again many thanks
Bagleys
Hi
I have made a program that i would like to be able to move from PC to PC; at the moment i would have to change the string directories within the program for each PC i would like top run it on.
By having the user select their drive letter and type their account name into a text box could this be implemented into a directory.
Below is the code, as i was hoping it was coded (lol never is tho).
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Filename As String = ("*.torrent")
Dim HDDLocation As String = TextBox1.Text
Dim AccountName As String = textbox2.text
If System.IO.File.Exists((HDDLocation)"documents and settings", (AccountName), (Filename)) = True Then
Try
My.Computer.FileSystem.DeleteFile((HDDLocation)"documents and settings", (AccountName), (Filename))
MessageBox.Show("Deleted")
Catch
MessageBox.Show("Unable to DELETE.", "Error")
End Try
End If
End Sub
Any help on this would be greatly appreciated.
Many thanks
Bagleys
Thank you so much for your help its working now. I have put in a new button to delete the files and it works great :). The button i was using is performing lots of other functions as well, so for some reason didn't delete the items; I think i need to restructure the events within the button1.
Thanks again for your help, much appreciated
Bagleys
Hi thanks i have tried the code, the error code i was getting has gone now but the files don't delete, any ideas?
Here's the code iv got:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim folderInfo As New IO.DirectoryInfo("C:\Documents and Settings\Andy\Application Data\uTorrent")
Dim arrFilesInFolder() As IO.FileInfo
Dim fileInFolder As IO.FileInfo
arrFilesInFolder = folderInfo.GetFiles("*.torrent")
For Each fileInFolder In arrFilesInFolder
CheckedListBox1.Items.Add(fileInFolder.Name)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each item As Object In CheckedListBox1.CheckedItems
If item.GetType() Is GetType(FileInfo) Then
CType(item, FileInfo).Delete()
ElseIf item.GetType() Is GetType(String) Then
Dim fileInfo As New FileInfo(item.ToString())
fileInfo.Delete()
End If
Next
End If
End Sub
Hi thanks for your reply, im at col at the moment so will try it later.
Many thanks
Bagleys
Hi i am trying to delete a file(s) from a checked list box, when i click a button. This is the code i have:
Dim item As IO.FileInfo
For Each item In CheckedListBox1.CheckedItems
Try
item.Delete()
Catch : End Try
Next item
But i get the error: Unable to cast object of type 'System.String' to type 'System.IO.FileInfo'.
Am i doing something really stupid lol, any help would be appreciated
Many thanks
Bagleys
Hi sorry im very new to VB. Thanks very much for your help its working now.
The code is:
Dim number As Decimal
number = 105.01
[number] = Decimal.Parse(TextBox16.Text)
If TextBox12.Text >= 105.01 Then
TextBox16.Text = TextBox12.Text - 105.01 * 0.128
ElseIf TextBox12.Text < 105.01 Then
TextBox16.Text = "Not NI Eligible"
End If
Hi thanks for the quick reply
That seems to be working as it now displays the a number if the textbox12 is over 105.01 and the text if its not; but i still get the errors System.InvalidCastException any ideas?
Thanks
Bagleys
Hi im really new to VB and am stuck on an IF statement, heres my code:
If TextBox12.Text >= 105.01 Then
TextBox16.Text = TextBox12.Text - 105.01 * 0.128
ElseIf TextBox12.Text < 105.01 Then
TextBox16.Text = "Not NI Eligible"
End If
When i debug it the error System.InvalidCastException is displayed four times for this bit of code.
textbox12.text is defined as a decimal within this Private sub buttonclick is that makes a difference
Any help on this would be appreciated
Thanks
Bagleys