Quick query...I'm trying to scan a long string and return any values that occur between the tags <FileName> and </FileName> I've got a bit of code here to use regular expressions to return the position of the occurunces of both substrings..Just wanted to find out if there is any way to scan for both substrings within one loop (as im currently doing 2, one for the first substring and one for the 2nd) so I can use something along these lines:
How would I do that? Sample code is below that demonstrated that the file I opened contained the full path and file name.
I want to extract just the path and serialize that to the user.config file as a UserSetting value. Then next time the user opens the dialog box, it uses that saved path string to go immediately to the location previously used.
If openFileDialog1.ShowDialog() = DialogResult.OK Then Properties.Settings.Default.persistConnectionType = openFileDialog1.FileName Properties.Settings.Default.Save();
I have a Listview on my form with different files. I can selet a file en open it with the proces start method. To open the file i use the OpenFileDialog method and select the filename. This work very good. With the code below.
My question is if there is a method to get the selected file without using the OpenFileDialog Box. So when i dubbelclick the selected file the proces will start with open the selected file. Something like:
proc.StartInfo.FileName = Me.SelectedCell.FileName instead of proc.StartInfo.FileName = Me.OpenFileDialog1.FileName
PS) May be i can preduce the Filename using the OpenFileDialog method on the background.
Private Sub ListView1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick If Me.OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
This code works on my local machine (Windows 7 Ultimate).When I tried it on WindowsXP,it didn't even open the dialog,instead it gave me an Unhandeled Exception error.
I can't remember the specific details of the error,but I do recall my profesor telling me there could be something wrong with permissions(me being the ONLY user on my machine,and his machine having multiple user accounts).
But what does all that have to do with opening the SaveFileDialog?
Could it be that SaveFileDialog1.AutoUpgradeEnabled = True is causing the problem?
My users need to browse to select a file and then save it to a different location. Here's my code I've got so far - it incorporates the OpenFileDialog to open the file and the SaveFileDialog to save the file. When the code goes into the OpenFileDialog portion, it works great....the initial directory is set to "C:" This is where the user will select the file they want to save to another location.
I have an .net 1.1 framework application I would like to update to 3.0 framework (or at least 2.0), but I've just run into a real problem. The savefile dialog code which works fine in 1.1 does not work in 2.0 and up. Line for line the code is the same (thereis no difference in line numbers at all). I'm baffled.With the exception of throwing an error for the Quicktime 7 control, VS2008 indicated no errors in converting 1.1I open my 1.1 (VS 2003) version and step through line-by-line. Works as advertised.I open my 2.0 (VS 2008) version and step through line-by-line. Appears to be working, dialog opens fine, I enter a filename, code continues; but when complete, there is no file in the folder.I'm wondering if the problem lies in the block of code for the small XML file I'm writing.
Imports System.IO Public Class Form1 Private fn As String
i want to have a SaveFileDialog for CSV-Export. Here is my code:
Private Sub btnExportCSV_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExportCSV.Click Dim da As New SqlDataAdapter("select * from tbl_gesamtminuten", conn) Dim ds As New DataSet() da.Fill(ds, "tbl_gesamtminuten")
It allows me to browse and/or create a file, but when I click the save button it transfers the new files directory to anothe savefiledialog box. I cant get it to close the search and place the path in the InputBox.
simple question but I don't know much about the savefiledialog component. I know I can bring up the dialog with savefiledialog.showdialog but what I want to do is allow the user to browse to a location to save the file, press okay then that destination be placed in a textbox on the form?
I am using SaveFileDialog with SaveFileDialog1.CreatePrompt = True.When I go to save a File and write in a name that is not created yet, a pop up box comes up and says do you want to create this file. I click yes, But it dosent create a file? Here is my section of code.
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click SaveFileDialog1.Title = "Specify Destination Filename"
I have not tested this, but I am fairly certain it would not work.When my program installs, I want to ensure that the default SaveFile directory is into a directory under the program's directory.For example, if the program installs to C:Program FilesConcept VisionsWorldFileMaker, I want the SaveFile dialog to default to C:Program FilesConcept VisionsWorldFileMakerWorldFiles.I can see in the File System of the setup project, under the property 'DefaultLocation', it's value is:
[ProgramFilesFolder][Manufacturer][ProductName]With Manufacturer = Concept Visions and ProductName = WorldFileMaker, am I correct in assuming this would be C:Program FilesConcept VisionsWorldFileMaker on a default Windows machine?
Below is the code I use to open the SaveFileDialog to save the file. The line in bold is the line I have my question about. How do I get the saveFileDialog1.InitialDirectory = "C:Program FilesConcept VisionsWorldFileMakerWorldFiles" without actually hard-coding it as "C:Program FilesConcept VisionsWorldFileMakerWorldFiles"? I want to use a substitution variable similar to "[ProgramFilesFolder][Manufacturer][ProductName]".
Eventually, I want to learn how to allow the user to install in a folder of choice. If I am correct, I would need such a substitution variable.
I am attempting to save a graph that I have displayed on the screen as an image file (e.g., a jpeg file) but the image I want to save has additional information such as axis labels that are not displayed on the screen. In addition, I also want to suppress some information that appears on the screen.
I create a separate bitmap canvas called mycanvas and I recreate my display on this canvas with the additional information. When I save it with an image format such as iftype=system.drawing.imaging.imageformat.tif with the command mycanvas.save(filename,iftype), I get the image file that I created on mycanvas. But If I use the SaveFileDialog followed by mycanvas.save(filename,iftype) I merely save the image displayed on the screen. It is as if my graphics object has reverted back to the graphics object I was using for the screen display.
Is there a dialog box for loading files, the same as the savefiledialog? I know how to load a file once I know it's name/location, but how do I open up a box to allow my user to select a file from the drive?
I was trying to export a data from the listview control into an excel format and I was able to make it successfully using a command button directly. I want to use a SaveFileDialog to export and save the content of the listview. I searched from MSDN website and got a sample code which was originally intended for saving an image file. I tried to used it and edit the code and combine my code to export the data content. It ran successfully and attempt to export the data in an excel format but when you open the file in the path as to where you save the data, it gives you a message "Excel cannot open the file 'Filename.xlsx' because the file format or extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file." and it just leaves an empty excel file. I read from the MSDN site that if you are using an MS Office 2007, the file extension for excel would be '.xlsx' and not 'xls'. Let me give you the two codes I tried to use. First, I used command button and was able to successfully export and save the content in an excel format but using the SaveFileDialog was not successful. I suspected that there's something wrong within this line 'oBook.SaveAs("saveFileDialog1.FileName.GetType()")' and 'Dim fs As System.IO.FileStream = CType _(saveFileDialog1.OpenFile(), System.IO.FileStream)'.
Here are the two diffrent codes I used:
'Using the command button-----successful Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim oExcel As Object