VS 2010 : Formatting A USB Drive?
May 26, 2010formatting a USB Drive?
Imports System.Reflection
Imports System.IO
formatting a USB Drive?
Imports System.Reflection
Imports System.IO
I have to create a program to manage a large number of USB Thumbdrives. In short, the drives will contain corporate images used by technicians to prep machines in the field. I do not have to create the images as they are already provided. Since I have to create 50 plus of these at one time, I am looking at writing a program to automate the process. As it stands now, formatting, partitioning, and copying the image to each key individually is, as you can understand, not efficient time wise. I have already purchased two industrial quality 7 port powered hubs.
The plan is to be able to: Fill all 14 slots in the hubs with USB ThumbdrivesUse the program to select the drives to prepareHave the program format and partition the drives (bootable)Copy the contents of the image folder provided to the USB keys. The idea is to do the above by filling all the slots and hitting one button, then walking away to do other work. When done, the drives would be ejected, and the next set of 14 installed.
I have already created the User Interface. It consists of: 5 buttons (Scan For Drives, Format Drives, Build Drives, Build And Format Drives, Exit).One "Select Source" entry field to select the source of the Image Files.One Checked Entry List. This is where all available drives will be listed, and the one's desired to be checked.
Now, it has been 20 years since I did any coding, and all of that was done in languages that are pretty much dead today (Turbo Pascal, Clarion Professional Developer and R:Base), so to say I'm behind the curve is an understatement. While I was never a real fan of Basic, I have some experience with it. But today's VB.Net ain't your daddy's basic, and there's no way I have time to learn C or C++. I have the Express version of Visual Studio 2010, which should be fine for this project.
I want to make an application that allows you to format a drive.My application consists of a combo box (so user can select drive) and a format button to format the selected drive.
I would like to know is this possible and if so how?
I've developed a MySQL chat app that I have in my program. It works perfectly, however all of the text is the same color. I use a silver-on-black scheme. I'd like to do 1 of 2 things, whichever one is.. er.. "more possible". The first option would be simple - alternate each row's back color. So that one row would be silver-on-black, the next row would be black-on-silver, and so on alternating. Each row is separated by a "vbCrLf". The second option would be to merely bold or turn to white the info text. Here's the format of the chat messages: [{time} - {user}] {message}. I would want [{time} - {user}] to be bold and white. Are either of those 2 options possible? Well, I know they're possible
View 1 RepliesI have been searching for a way to format output using writeline/write (streamwriter)using RTF tags and wondering if there is a syntax for this, if it exists. I have not been able to find a resource which clearly explains how to "pretty" up output sent to a file.
The reason why I am asking is because I want to "print" results from my program into a file that, at the very least, would be centered, tabbed and even bolded where possible without requiring the user to go and futz with it. I think I saw that Crystal Reports won't work with VB 2010 Express and, quite frankly, just want to create a file with output.
[Code]...
I was using VB6 and all my text formatting is stored in a database from the way VB6 stores it. How do I apply this formatting to a rich text box in VB 2010?
View 6 RepliesWhen a certain form (containing a datagridview (dgv)) is first loaded, the dgv cell formatting event is triggered by the line
dgv_WorkHistory.DataSource = ds_WorkHistory.Tables(0).DefaultView This successfully adds some background colour to a few cells in the displayed table. After this the next line of code is executed. The problem is that if I then try to load a different table (by choosing one from a listbox), the new table displays OK but without the desired formatting. Why?
Stepping through the code I find first of all that when I click on the listbox the dgv cell formatting event is instantly raised (immediately, even before any code in the listbox click event is executed). Why does clicking on the listbox trigger the cell formatting event?
Then, when execution reaches the line quoted above for the second time (remember it triggered cell formatting the first time round) it doesn't this time trigger it. The next line of code is executed instead. Why has the behaviour changed?
I have some text displayed in a richtextbox from an xml. This is how is shows upHaste <i>(As soon as it comes under your control.)</i>At the beginning of the end step<i>The storms of the wastelands form quickly and hit hard. Few have anything to do with rain.</i>
View 1 RepliesI'm running the following WMI script to get the associations between drive letters and physical drives on the system, but for some reason it omits CDROMs/DVD-ROMs. Can someone tell me how to get those as well?
Code:
ComputerName = "."
Set wmiServices = GetObject _
("winmgmts:{impersonationLevel=Impersonate}!//" & ComputerName)
Set wmiDiskDrives = wmiServices.ExecQuery _
("SELECT DeviceID FROM Win32_DiskDrive")
[Code3]...
Anyone know how i can get the harddrive id?
View 1 RepliesI have a program that creates a excel spreadsheet and a chart on each tab from extracted data in various .txt files. Before the chart is created, two of the excel columns will end up with data like this: on column 9 and 10. I also use data (time, looks like 09:15) in column 11 that shows the time at the bottom of the chart. There are just too many digits in the output and the readability looks bad so I can also convert.
Input Output
800400047320000
825400047120000
[code]....
The chart will display those values just fine but, normally the conversion in code that I do during the placement of that data (so it reads a bit better) looks like this:
'Convert bit to Kbit
If InRate.Length < 7 Then
InRate = CDbl(InRate) / 1000 & " Kbit"
[code]....
how to make the chart work with just numbers and ignore the MB or Kbit at the end?
I have set up a form that will act as my parent (this hasnt been set up as an MDI).On this form I have a Panel that I will be loading forms into. I have a form that contains a DGV. On the load of the parent form, I then load this "child" form into the Panel. In the onLoad event of the "child" I go off to the database and populate my DGV. Then I run through the rows in the DGV and add in a logo image in the first column and change some cell colors based on values in those cells.
This all works great, however, when the child form finishes loading all the changes are lost. eg The logo images go back to the red cross and the cell coloring is gone.If I call Me.Refresh() in the child window as the last line in its Form_load event I can see the logo and cell colors update to what I want, but as soon as it has updated, its like it immediately refreshes again and all the changes are gone.
I'm updating a program that was written in an older version of VB (by someone else) and I can't figure out to how replicate this data entry line in my Form.
Each textbox can be changed and there is a nice scroll bar at the bottom to move left and right as you enter each datapoint.
I tried using multiple tabs within a Panel and setting the Appearance to FlatButtons, but the text area under each tab gets covered when you select another tab.
I need to take a string of any length & make it exactly 5 characters long by either truncating it or padding it or neither. So "abcdefgh" becomes "abcde", "abcde" stays "abcde" & "abc" becomes "abc " (2 spaces at the end).
I currently use this line of
Microsoft.VisualBasic.Left(myString, 5).PadRight(5, " "c)
it works, but it seems very hackish.
loping application to make bootable USB drive, for that i wants to format usb drive.but I couldn't find any way for the same.I got solution that suggests use of SHformatdrive(), but how can i include that function.I am using VB 2010 (VS2010). Is there any different way
View 8 RepliesFor some reason, I can get the first chart to become formatted using the code below, but the other 4 won't format properly. I had a similar problem with the DataGridView's, but I moved all of the with statements before I adjusted the Charts and they now work. I can see no reason why this would cause only one chart to be formatted and the rest to stay blank. The code was copied and renamed in the With statement for the appropriate Name of the charts.
[Code]...
I have:
1 ComboBox(cboCultureInfoNumeric) with the required CultureInfo.
1 Textbox(txtNumeric)
1 Label(Label1)
When the user change the Culture info the decimal point or comma change in the textbox(txtNumeric) nicely.What i try is to change also the text in Label1 by the culture info.If the user change the CultureInfo to German the Label1.text = �German�If the user change the CultureInfo to Spanish the Label1.text = �Spanish� And so on�
What I have do is :
1 - Set the Form1 Localizable property to true.
2 - Set the form's Language property to "German (Germany)".
3 - Set the Label1 Text property to "German".
VB make the file -> MainForm.de-DE.resx with name: Label.Text and value: German
4 - Set the form's Language property to "Spanish (Spain)".
5 - Set the Label1 Text property to " Spanish ".
VB make the file -> resx
6 - Set the form's Language property to "French (France)".
7 - Set the Label1 Text property to "French".
VB make the file -> resx
8 - �The TextBox with the numeric value�s change when the user change the CulureInfo but not the Label1, why?It work perfect when I put �Thread.CurrentThread.CurrentUICulture = New CultureInfo("fr-FR")in the MainForm.designer.vb before InitializeComponent function and in the New function.But I want to use the ComboBox�
How can we check if a Drive exists in the system
View 4 RepliesI found sume code in VB6- but converted it to VB.NET 2010. The program puts all of your drives into a listbox but its only the letter name, how can i get the drive name too? Here is my
[Code]...
I'm currently writing a program which has a requirement to reassign drive letters if a drive with a particular volume name is plugged in to ensure that it is assigned to the correct drive letter.
[Code]...
Using WMI (and it's code creator) it is easy to find the name of the physical disks on the computer.
vb.net
Dim searcher As New ManagementObjectSearcher("rootCIMV2", "SELECT * FROM Win32_DiskDrive")
For Each queryObj As ManagementObject In searcher.Get()
MessageBox.Show(queryObj("Caption").ToString)
Next
Tried to google how to get the drive letter from each of the disks.
I am trying to run a visual studio 2010 app from a windows 2003 server machine that writes xml files to a folder stored on a remote windows 2008 server. I mapped the server drive and can access the folder manually but in the code the 'access is denied' error is hit when the file path declaration is hit for that 2008 server folder. I checked the access writes to that folder and made sure it is shared for that user. Also the user I am logged into on the source server has admin rights so should it not be able to access the mapped drive through the application?How do I grant my app access to that or any folder on that drive on the remote server? I had this issue before but cannot remember what I did to clear this up.
View 1 RepliesI'm quite new to programming and I am working on a project. The aim is to automatically run a backup process once a removable drive is inserted.So far I've been using this piece of code[code]....
This obviously only runs once unless I use a loop or timer, however both of those will cause the backup process to loop as well.
I have some VB .NET software that interfaces to a load of old (but sound) COM objects. The VB provides a GUI for the COM objects, part of which consists of setting various options on the COM objects - several of which relate to string formatting.I have a simple pair of VB .NET functions that convert basic %f, %d, %g formats to/from .NET equivalents using a large select case covering specific common strings, but they don't cover all formats.[code]Before I start diving in and making it more versatile with some parsing, does anyone know of a class (eg VB or C# .NET) that provides a decent ready-made implementation? Or perhaps some regexp wizadry could be used?
View 2 RepliesI have a program that allows the user to enter a drive letter into a text box. The program then takes the letter and find the physical drive number (i.e. deviceharddisk3..). It then stripes out everything and leaves me with the number 3.
In VB6 I used mDrive.bas from vbAccelerator.com and it worked perfectly. I have been all over the internet and back and cannot find a solution written in VB.NET.
I want to make a tool that will assign a USB pen drive a drive letter, I am using WMI to acknowledge the device being plugged in, I can pull the deviceID, name, etc now I just need to work out how to assign the device to a drive and I just cant figure it out
View 4 RepliesI'm filling a DGV by setting it's datasource property to a datatable, but for a DateTime columns it doesn't show seconds.
View 4 RepliesI have now started posting to a MySQL database created by someone else. I have no ability to change the table structure.Two questions:
1) There is a date field and a time field that loosely tracks the last edit date and time. Both are fields set up as DateTime in the database. The date field always has the proper date but the date and time portion shows as
2011-11-27 00:00:00
However, the time field shows as
1899-12-30 23:16:58.
When I am updating with the following code
strSQLCmd.Parameters.AddWithValue("@EditDate", Date.Now)
strSQLCmd.Parameters.AddWithValue("@EditTime", TimeOfDay)
The date field displays
2011-11-27 23:40:26
and the time field displays
0001-01-01 23:40:26
I'm not sure how to format the date field without time and the time field with Dec 30 1899.Question 2) I will be adding some tables and will be wanting to track date and time of first entry as well as date and time of last edit. (this may have been better posted in the Database forum, if so, sorry)
For those of you who have done this before, would you mind sharing best practises? I am wondering why would you use two fields, one for date and one for time, when the field is a date/time field to begin with. I've seen this before in another database as well. I'm just trying to work out the logic here.
I am trying to build an autorun application for windows 7 and I need to retrieve a drive's VOLUME serial number (the one that changes when you format it)
View 4 RepliesI recently reformatted my computer and now that I try running a program I made beforehand, I always get an UnauthorizedAccessException when the program tries to access the D drive. How do I make it authorized? I tried changing the security settings for the D drive but that wasn't really much help.
View 1 Replies