I am trying to get the save/open dialog figured out. I am able open the save
dialog but when I put in a file name (whatever.txt) and save the file does
save with the name but it is blank. Below is what I have code so far.
Dim phonestreamwrit er As StreamWriter
Dim responsedialogr esults As DialogResult
SaveFileDialog1 .InitialDirecto ry = Application.Sta rtupPath
responsedialogr esults = SaveFileDialog1 .ShowDialog
If responsedialogr esults <> DialogResult.Ca ncel Then
phonestreamwrit er = New StreamWriter(Sa veFileDialog1.F ileName)
End If 3 1985
You open the StreamWriter which creates the file, but you also have to write
something to it. For example, if you added the following line after you
create the StreamWriter:
phonestreamwrit er.WriteLine("H ello, world")
phonestreamwrit er.Flush()
phonestreamwrit er.Close()
the underlying file would have the content "Hello, world" inside the file.
You have to define what is supposed to go into the file. The save/open
dialog is only used to query the user for the file path.
--
Ben Lucas
Lead Developer
Solien Technology, Inc. www.solien.com
"Newbie" <Ne****@discuss ions.microsoft. com> wrote in message
news:DB******** *************** ***********@mic rosoft.com... I am trying to get the save/open dialog figured out. I am able open the
save dialog but when I put in a file name (whatever.txt) and save the file does save with the name but it is blank. Below is what I have code so far. Dim phonestreamwrit er As StreamWriter Dim responsedialogr esults As DialogResult SaveFileDialog1 .InitialDirecto ry = Application.Sta rtupPath responsedialogr esults = SaveFileDialog1 .ShowDialog If responsedialogr esults <> DialogResult.Ca ncel Then phonestreamwrit er = New StreamWriter(Sa veFileDialog1.F ileName) End If
If I have text in a rich text on a form how do I write that to the file
RichTextBox1.Te xt = SaveFileDialog1 .FileName????
"Ben Lucas" wrote: You open the StreamWriter which creates the file, but you also have to write something to it. For example, if you added the following line after you create the StreamWriter:
phonestreamwrit er.WriteLine("H ello, world") phonestreamwrit er.Flush() phonestreamwrit er.Close()
the underlying file would have the content "Hello, world" inside the file.
You have to define what is supposed to go into the file. The save/open dialog is only used to query the user for the file path.
-- Ben Lucas Lead Developer Solien Technology, Inc. www.solien.com
"Newbie" <Ne****@discuss ions.microsoft. com> wrote in message news:DB******** *************** ***********@mic rosoft.com... I am trying to get the save/open dialog figured out. I am able open the save dialog but when I put in a file name (whatever.txt) and save the file does save with the name but it is blank. Below is what I have code so far. Dim phonestreamwrit er As StreamWriter Dim responsedialogr esults As DialogResult SaveFileDialog1 .InitialDirecto ry = Application.Sta rtupPath responsedialogr esults = SaveFileDialog1 .ShowDialog If responsedialogr esults <> DialogResult.Ca ncel Then phonestreamwrit er = New StreamWriter(Sa veFileDialog1.F ileName) End If
phonestreamwrit er.WriteLine(Ri chTextBox1.Text )
"Newbie" <Ne****@discuss ions.microsoft. com> wrote in message
news:D8******** *************** ***********@mic rosoft.com... If I have text in a rich text on a form how do I write that to the file
RichTextBox1.Te xt = SaveFileDialog1 .FileName????
"Ben Lucas" wrote:
You open the StreamWriter which creates the file, but you also have to
write something to it. For example, if you added the following line after you create the StreamWriter:
phonestreamwrit er.WriteLine("H ello, world") phonestreamwrit er.Flush() phonestreamwrit er.Close()
the underlying file would have the content "Hello, world" inside the
file. You have to define what is supposed to go into the file. The save/open dialog is only used to query the user for the file path.
-- Ben Lucas Lead Developer Solien Technology, Inc. www.solien.com
"Newbie" <Ne****@discuss ions.microsoft. com> wrote in message news:DB******** *************** ***********@mic rosoft.com... I am trying to get the save/open dialog figured out. I am able open
the save dialog but when I put in a file name (whatever.txt) and save the file
does save with the name but it is blank. Below is what I have code so far. Dim phonestreamwrit er As StreamWriter Dim responsedialogr esults As DialogResult SaveFileDialog1 .InitialDirecto ry = Application.Sta rtupPath responsedialogr esults = SaveFileDialog1 .ShowDialog If responsedialogr esults <> DialogResult.Ca ncel Then phonestreamwrit er = New StreamWriter(Sa veFileDialog1.F ileName) End If This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andras Gilicz |
last post by:
Hi VB fans
I'm working on a relatively large project in VB6 with about a dozen
forms, including graphs, labels, text boxes, etc. The software itself
is actually a flow simulator with more or less complex technical
calculations, several input variables. I would like to equipp the
starting panel with the usual New, Open, Save, Save As, Close etc.
menus (like in Excel, or Word, etc.) What is the best way to
accomplish Save, or Save As?...
|
by: John |
last post by:
Hi,
I generate a report in a comma delimited file and give it
a name like MyReport.csv . I then set a Hyperlink
control to point tp the file
HyperLink1.text = "Download"
Hyperlink1.NavigateUrl = "MyReport.csv"
When the user clicks the HyperLink I would always like to
|
by: Dune |
last post by:
Hi there,
I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they entered. When this button is pressed and extract is prduced and IE's standard Open/Save dialog should popup so they can navigate to the directory to save the extract in, or if they want, they can choose to open and view the extract without saving it.
...
|
by: Mike |
last post by:
can i open the save file dialog box from a asp.net web page?
thx
|
by: sunilj20 |
last post by:
Hello,
I have a requirement wherein, a user clicks on a file name in an
ASP.NET web application, and the file should automatically be
downloaded (Without showing the "Open", "Save As") in the local machine
at a pre defined path (path defined in the registry), and launch the
file in its associated application.
I think this can be done through ActiveX Controls, but i dont know how
to create ActiveX controls in .NET??
| |
by: Patrick |
last post by:
Following on from the excellent example at
http://www.c-sharpcorner.com/Code/2003/Sept/ExportASPNetDataGridToExcel.asp
on how to save a data-grid to excel file, how can I extend the example such
that when the user click on the button a popup appear in IE to say "Do you
want to save or open file?"
|
by: Newbie |
last post by:
I am trying to get the save/open dialog figured out. I am able open the save
dialog but when I put in a file name (whatever.txt) and save the file does
save with the name but it is blank. Below is what I have code so far.
Dim phonestreamwriter As StreamWriter
Dim responsedialogresults As DialogResult
SaveFileDialog1.InitialDirectory = Application.StartupPath
responsedialogresults = SaveFileDialog1.ShowDialog
|
by: Michael Groeger |
last post by:
Hi,
I have an aspx page which generates an excel document and transfers it to
the browser as attachment. Normally, once the document is transferred the
open save dialog prompts to open or save the excel document. When I click
save I can save the excel document or when I click open it directly opens in
excel. This works fine for all but one machine.
On one machine however the dialog prompts to open or save the excel document
(e.g....
|
by: Rameel |
last post by:
Friends,
I'm probably being more critical with VB.Net Windows application.
I have Developed VisualStudio 20005 VB.Net Windows application
how willl i be able to save a specific record into my database file throu GUI Save Record button?
As i write the comand as foloow but it is not inserting the new record in to the Access Database.
Public Function Open_Connection() As Boolean
Try
Select Case...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |