I have an application where users opens more than one windows on an MDI form.
I want users to be able to save their work environment for future opening and used. When next the saved look is open, all previously opened windows should also open at exactly where they were before closing/saving the work area.
Save the information to a database table linked to the user or save it to an xml file on the user's computer
Then when the forms are next opened consult these saved settings and restore the forms to how the user left them.
“That which can be asserted without evidence, can be dismissed without evidence.”
I was trying this TreeView demo and ran into a situation where a Try Catch block will not pass execution onto the Catch code. The error is "Drive not ready" when attempting to access a:\. That is easy enough to understand...I have no floppy on my system. But why does the error handler not pass the error to the Catch area?
Many thanks for any advice!
Here is the demo:
A form just has a TreeView and a button on it. The demo populates a TreeView with the directories of my file system:
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Get a list of drivesDim drives As System.Collections.ObjectModel.ReadOnlyCollection(Of IO.DriveInfo) = My.Computer.FileSystem.Drives
Dim rootDir AsString = String.Empty
'Now loop thru each drive and populate the treeview:For i AsInteger = 0To drives.Count - 1
rootDir = drives(i).Name
'Add this drive as a root node:
'Populate this root node:
NextEndSubPrivateSub PopulateTreeView(ByVal dir AsString, ByVal parentNode As TreeNode)
Dim folder AsString = String.Empty
TryDim folders() AsString = IO.Directory.GetDirectories(dir)
If folders.Length <> 0ThenDim childNode As TreeNode = NothingForEach folder In folders
childNode = New TreeNode(folder)
NextEndIfCatch ex As UnauthorizedAccessException
parentNode.Nodes.Add(folder & ": Access Denied")
I am very new to programming... I have opened a vb2003 application in visual studio 2010 and have had some thread safe problems when trying to modify a text box from a non-parent form. I implemented the below that I found on a thread with good results:
PrivateSub SetLabelText(ByVal s AsString)
IfMe.lbTime.InvokeRequired ThenMe.lbTime.Invoke(New Action(OfString)(AddressOf SetLabelText), s)
'Me.lbTime.Invoke(New Action(Of String)(AddressOf SetLabelText), s)ElseMe.lbTime.Text = s
Now when I try to modify the attached for an array of textboxes, while passing the array index into the sub routine I get a "Does not have a signature compatible with the delegate." error. Is it possible to have a delegate with multuple parameters? Is there an easier way to accomplish a threadsafe multiple textbox modifications?
PrivateSub SettxtChannelData(ByVal arrIndex AsInteger, ByVal s AsString)
IfMe.txtChannelData(arrIndex).InvokeRequired ThenMe.txtChannelData(arrIndex).Invoke(New Action(OfString)(AddressOf SettxtChannelData), s)
ElseMe.txtChannelData(arrIndex).Text = s
I have trouble passing arguments to the Process.Start in VB.NET.
What I want to accomplish is to backup a mysql database with its mysqldump.exe which is located in my C drive. I have a code that can do it perfectly when run in the command prompt. The problem if face comes when I want to pass that same code to the process.start.
And it still bring me the error "The system cannot find the file specified" Error message.
Can you please tell me what the problem is and how I can get through it? Please remember that, if I take the contents of txtProgram.text and txtArguments.text and put them to a command prompt, it works fine.
*I have also searched other threads here, no one had an exact similar issue like mine.
Please remember that, if I take the contents of txtProgram.text and txtArguments.text and put them to a command prompt, it works fine.
You are writing the output of mysqldump into a file using the redirection operator >. This is implemented by the command processor, cmd.exe and to get the same effect using Process.Start the various bits should be
Environment.GetEnvironmentVariable("COMSPEC") resolves to the path of the command processor and is convenient way of locating that program on any system. The arguments are now the command line you would have typed at the prompt, prefixed by /c to tell the command processor to exit once mysqldump has ended. Check all the quotes as I may have these wrong, VB isn't my usual language.
One thing to watch out for when using Process.Start is the working directory. If this needs setting then you should create a ProcessStartInfo object and use the correct overload of Process.Start.
Thank you Alan!
But, I tried your suggested code and, when I run it, a small command prompt window appears and goes away suddenly without giving me time to read it, but I have been able to read that it brings that error message that says ".....is not recognized as internal or external program..batch file..."
But, at least its not saying "the system can not find the file specified"
Do you have any other idea on this? (Sounds like the solution is only few miles ahead!)
This might be a little tricky, I don't even know if it's possible.
I've got some code working, but to optimize the performance, I'd like to rewrite parts of it to enhance the performance.
The tables that need to be processed start with a merged cell (spanning all columns), but can be interrupted by another row where all cells are merged. The 2nd row always contains the same text but does not have to be processed.
I'm looking for some time now for an answer to the following questions:
* Is there a way to check if a table is uniform from the 3rd row on? Looping works, but it gets slow on long tables, so I want to avoid looping if possible.
* If the table is not uniform, is there a way to know wich rows are merged (also without looping if possible)?
* One column is populated with ID numbers, wich consist of a number, a linebreak (not a paragraph break) and a code. I want to set the font size for the number to 8 and the font size for the code to 1. Is there a way to apply this to the whole column at once instead of looping trough the cells?
If there's no way to avoid looping, it's not too bad. I've got the code working now, using loops, but since it can take over 5 minutes processing a table of say 600 rows (45 pages), I'm just looking for ways to increase performance.