Writing The Save Option - Code Up The Save Menu Option So That It Updates The Current Document?
Jun 10, 2010
I am writing a text editor program and I have written the new, open, save as, exit menu items but I am struggling with writing the save option.Now I have created the menu itself (well vb did, I just used insert standard items) but how do I code up the save menu option so that it updates the current document or if the documnt has not yet been saved bring up the save file dialog.Here is the code I have so far
Public Class Main
Private Sub NewToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripButton.Click, NewToolStripMenuItem.Click[code]....
I know I have some finishing touches such as messages and error handling and stuff but at the moment I want to get all the basics working,I think the save menu option is all I am struggling with at the moment.
View 1 Replies
ADVERTISEMENT
Aug 5, 2010
I have written an MDI text editor, its almost complete, but I cant get the save as menu option to work correctly.
HTML
'This sub routine controls the save as menu option
Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles[code].......
So whats happening is that it opens the dialog ok, saves the document to my chosen location correctly, but opens a new document and gives the new document my chosen file name and leaves my saved document with the file name New Document.But when I close all the open screens and then re-open my saved document its all as it should be.
View 1 Replies
Aug 1, 2010
I have written a sub routine for a Save>Menu option for a MDI Text Editor, see my code below
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
Dim f As Form2
[Code]....
Now if I take out the ( I get yet another error which states
"Argument not specified for perameter "File" of public sub WriteAllText(File as string, text as string, append as boolean)
All I want is when the user clicks the save menu item the document either saves the changes made to the current document or the save as routine is involked.
View 4 Replies
Feb 4, 2012
I was trying to edit a excel document and save under different name and my coding for this is as follows.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Open
Dim MyExcel As New Excel.Application
MyExcel.Workbooks.Open("C:\Test\WalkAir.xlsx")
'Extract
MyExcel.Sheets("sheet1").Activate()
[Code] .....
While debugging the code it resulting with me an error message as Public member 'SaveAs' on type 'ApplicationClass' not found.
View 2 Replies
Mar 11, 2010
i have written a sub routine for a Save>Menu option for a MDI Text Editor, Please see my code below
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
Dim f As Form2
If f.Text = "Text Editor V.2 - New Document" Then
[Code]...
View 1 Replies
Aug 1, 2009
I have researched the net, youtube, and the msdn DB, and still can not find the working answer I am looking for. I would like someone to show me how you would save the contents of "Listbox1" to a .txt file using the "Save As" Option. I know how to hardcode a savepoint in, but since there will be multiple users I would like the option to be up to the end-user.
View 4 Replies
Jun 24, 2010
I'm just trying to have my "exit" option in my menu strip remind the user to save their settings...If they haven't, the click "no" and save their stuff, and then exit. I can't get the form to close if I hit "yes."
[Code]...
View 4 Replies
Jul 28, 2009
I want my console application to be able to do one function I have when you click one option on the windows context menu, and another function when you click another option.
View 3 Replies
Nov 11, 2008
I only just now realized that the project does not update when it saves until you quit out of Visual Studio. As such I now have 7 backups that are exactly the same, including the main file. I would have lost hours of work if not for finding a copy that somehow had all of my work saved to it. It was named the same thing as four other projects, though, with the other three being the same work from hours ago. Where is this temporary project? I cannot find it on my computer, and I'm afraid of losing all that work. Also, is there a way to do a Save All, and then something like "Save the whole project as" without quitting out of Visual Studio, looking through folders, finding the actual project folder, and copy pasting that? In other words, is there a way to do that in Visual Studio itself?
View 3 Replies
Dec 14, 2009
I have an existing xml document with music playlist information, which is read into a GridView control in Visual Basic. I am now wanting to save any updates in the GridView to that xml document.[code]...
View 1 Replies
Oct 19, 2011
I am trying to save a file and I want to limit the user to a couple options being *.txt and I want to make the default *.txt. The code works to save the file, but I don't see the "save as type" option as having any choices and the default .txt extension is not in the file name field.
Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
'Write the converted string to the file
Dim FileToSaveAs As String = SaveFileDialog1.FileName
Dim FileWriter As New StreamWriter(FileToSaveAs)
[Code] .....
View 1 Replies
Sep 2, 2009
I have a form with multiple checkboxes what I would like to do is to have it that if someone selects any combination of the checkboxes they could save those selections by pressing a button named save options or something to that affect it would then save those selections then they could load them by pressing another button load options and run them with another button named run options (or the box that loads could run too) not sure the best way to do it the goal is ultimately to have a button that allows the state of the checkboxes to be saved and then run as a custom option.
how would I do this I cannot find anything on the Internet ?
View 12 Replies
Apr 12, 2009
I am trying to create a wpf program that allows the user to create custom shapes or pick premade shapes and that after making their selection, a canvas shows their shapes randomly sized, positioned, colored and copied in multiples. I am hoping that on click, the program will put its output on a time interval and that the user can click stop when they are satisfied with how everything looks. My issue is, I would like to also give the user an option to save their created artwork as a jpeg file. Also if I wanted to link this file to a web browser what will I have to do?
View 1 Replies
Feb 10, 2009
I'm trying to save an excel file:
vb.net
xlWBook.SaveAs("J:DOWNLOADS.xls")
xlWBook.Close()
xlApp.Quit()
If the file already exists excel will open an message box and ask if you want to overwrite. If I click yes, it works. If I click no or cancel, I get an error:
Exception from HRESULT: 0x800A03EC
How can I tell what button the user clicked?
View 3 Replies
Mar 28, 2010
I have to take over a project written in vb.net, which contains more than 400k lines of code written in option strict off mode. I want to build it under option strict on first before I do anything else -- which maybe converting it into C#. I found there's thousands of lines of code raises compilation error, mostly are about implicit type casts. Is there any tool would help to make it compile under option strict on mode if I don't want to correct every single line manually? Because it's really painful to add CStr/CInt invocation into every line of Code myself.
View 3 Replies
May 10, 2012
How to create a button with a MenuStrip option like one in MS-Office "Save As" dialog as below picture?
View 3 Replies
Feb 22, 2011
I really like the coding speed that vb.net provides, but I don't like the possibility to forget to declare variable types, return types of functions, etc. and that is why in each class I use[code]..
Is there a way to define those two options on the project/solution level?
View 2 Replies
Jan 26, 2010
the combo box style 1 has both the drop down option but also a manual entry option. I need to know how to code it so that when you manually enter data, it takes that data and places it in a text message "The shipping charges for "data" is $15" displaying in a text box. Shouldn't be hard but have developed a mind block.
View 4 Replies
Feb 24, 2010
what does these two code means in vb.net: Option Explicit on Option strict on i think option explicit means the compiler is not going to do any kind of conversion and i need to do all of them by the code;also it becomes case sensitive i.e;
[Code]...
View 8 Replies
Mar 27, 2010
I am trying to set up an app that has a menu and have each option run on a different thread. When I set up 2 thread to run I get the following error: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThread Attribute marked on it. This exception is only raised if a debugger is attached to the process.From what I have researched, it says to make sure the openfile dialog function should be used with the main thread only. Since I have <STAThread()> added above the main I'm not sure how else to handle this. The main thread needs to be listening for the menu options and if I change it around it runs that option and the other threads hang. [code]
View 4 Replies
Apr 2, 2009
I am learning Visual Basic Express 2008. When I follow step #5 below, the option Set as StartUp Project does not exist. How I can accomplish this. To create a test project for your class. Open the Persons project that you created in the previous lesson. If you did not save it, you will first have to go back to the previous lesson, Adding Methods to a Class, and complete the procedures.
On the File menu, point to Add, and then click New Project.
On the Templates pane in the New Project dialog box, click Windows Forms Application.
In the Name box, type PersonsTest and then click OK.
A new Windows Forms project is added to Solution Explorer, and a new form appears.
In Solution Explorer, select the PersonsTest project, and then on the Project menu, click Set as StartUp Project. In the Solution Explorer, select the PersonsTest project, and then on the Project menu, click Add Reference. The Add Reference dialog box appears.
Click the Projects tab, and then select Persons and click OK.
Double-click the form to open the Code Editor, and then enter the following declaration just under the line Public Class Form1.
View 7 Replies
Jan 20, 2011
so i have a quite huge program. but lets say i have one label. and i want to save that. i have the code and everything for saving the text of the label. now i want to assign ctrl+s to automatically save the labels text once pressed instead of going through a menu to choose save.this is like a regular texteditor where u press ctrl+s and it saves.
ive used this
If (e.KeyCode = e.Control & Keys.S) Then
MessageBox.Show("Ctrl+S pressed")
End If
and
[code]....
but it doesn't do anything once pressed.im also using the keydown declaration for the form.
View 4 Replies
May 1, 2010
I did some research and i found that i will need to edit the registry.So if i make a folder called "Get Path" in the ContextMenuHandlers folder.When i click on the file in windows explorer or desktop etc i will have the option called "Get Path".Now for the value key what do i put inside?What i want is when the user right - clicks on the file my program starts up and displays the path of that file on a msgbox or listbox. I was thinking of letting the Windows Installer (.msi) doing this for me.
View 37 Replies
Oct 17, 2009
How can I get round this error: Option Strict On disallows implicit conversions from
[Code]...
View 4 Replies
Feb 22, 2011
1. I have read that keeping Option strict on and Option infer off is good practice and will insure your code is tight and properly written. I would like input regarding this, pro's and con's from those who are in the know.
2. Having said that, I have set Option strict on and Option infer off in an existing program I wrote (that was working perfectly mind you) with them off and on respectively. I went through and cleaned up all the errors on the 'need AS' and casting of variables, but one is leaving me a bit put out.[code]
I have also read where using My.Computer.System.Directory.GetFiles() instead of System.IO.Directory.GetFiles() is probably not a good thing, but when I change to this I get no error, but also no dataI am thinking I should stay with the strict on and infer off but am really slogging through getting this code correct.Running Win7 on Dual Quad Core XEON Intel Extreme with 8Gb RAM.
View 2 Replies
Aug 7, 2009
Two(2) Things. I don't have the "Clickonce Option" when I select BUILD for the menu bar. I also don't have the "Step Into Option" from my DEBUG menu. Do I have a problem? Or do I need to turn something on?
View 4 Replies
Apr 17, 2009
[Code]....
I add a button to a form each time the user clicks a menu option as:
[Code]....
This draws a small blue line at the bottom of the button to show it is highlighted. Just like the mouseoverbackcolor property on a button except this will draw the line. It works fine until you slide the mouse very fast between the buttons. It is as if the mouseleave event doesnt always fire.
View 2 Replies
Mar 4, 2009
Using VS2008, targetting framework 3.5, trying to update some VB4 code. Yes, VB4.I have a bunch of legacy code I'm trying to update, and I had the idea of trying to work through it by executing the old code, working out what was causing each error as I came to it, solving the problem, and then moving on.In order to do this, I have sinned and set Option Strict Off, Option Explicit Off and Option Infer On.Yes, I'm going to hell for this.Problem is, I'm still getthing errors that various things haven't been declared.All of these the items showing errors are in the form: itemName(obj)Is my problem that the compiler thinks that these are method calls for methods which haven't been declared?PS: For anyone wanting to tell me not to use these settings, I already know
View 2 Replies
Nov 30, 2009
ive got a college project and I've tried to make it seem quiet realistic, i've added a menu strip, and I don't know how to code an option in the list. Does anyone know how to code it?
View 5 Replies
May 29, 2011
modify code to insert the data to MS SQL and save changes when click save button for the second time?
View 14 Replies