473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

FileOpen problem

CM
I'm learning VB6 from a book. The following code is
supposed to open a simple text file I created - putting
the text into my VB text box.

Private Sub cmdOpen_Click()
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then Text1.Text =
CommonDialog1.FileName
End Sub

Instead, the path and file name to the text file is
placed in my text box. Does anyone understand why this
doesn't work as described? I even copied and pasted the
author's code directly from an accompanying CD, and the
results are the same.

I appreciate anyone's help,

CM

Nov 20 '05 #1
11 1447
Cor
Hi CM,

This is a VB.net language group, that code is quiet different from classic
VB.

There are a lot of groups about VB.classic. To get a better answer you
could if you cannot find it after the answer i give you bellow better ask it
in such a newsgroup.
Private Sub cmdOpen_Click()
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then Text1.Text =
CommonDialog1.FileName
End Sub
You described it exact what happened here.

The path and file you get when you use the commonDialog is placed in the
textbox.

You need that path/file to open a file and than read that and place the data
in your textbox, but for that I would look again in your excercise if I was
you.
Instead, the path and file name to the text file is
placed in my text box. Does anyone understand why this
doesn't work as described? I even copied and pasted the
author's code directly from an accompanying CD, and the
results are the same.


I hope this helps you so far

Cor
Nov 20 '05 #2
"Cor" <no*@non.com> schrieb

This is a VB.net language group, that code is quiet different from
classic VB.

There are a lot of groups about VB.classic. To get a better answer
you could if you cannot find it after the answer i give you bellow
better ask it in such a newsgroup.


....and they are named microsoft.public.vb.*

:-)
--
Armin

Nov 20 '05 #3
* "CM" <an*******@discussions.microsoft.com> scripsit:
I'm learning VB6 from a book. The following code is
This is a VB.NET group. You may want to turn to one of the
microsoft.public.vb.* groups.
supposed to open a simple text file I created - putting
the text into my VB text box.

Private Sub cmdOpen_Click()
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then Text1.Text =
Better:

\\\
If Len(CommonDialog1.FileName) > 0 Then _
...
///
CommonDialog1.FileName
End Sub

Instead, the path and file name to the text file is
placed in my text box. Does anyone understand why this
doesn't work as described? I even copied and pasted the
author's code directly from an accompanying CD, and the
results are the same.


What would you expect to be placed in the textbox? The file name only?
Have a look at the CommonDialog's 'FileTitle' property.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Cor
Herfried,
What would you expect to be placed in the textbox? The file name only?
Have a look at the CommonDialog's 'FileTitle' property.


I did answer this post, Armin did give an addition to that post and than
again Herfried
start using a better newsreader Herfried.

The OP did write

The following code is
supposed to open a simple text file I created - putting
the text into my VB text box.

Cor
Nov 20 '05 #5
* "Cor" <no*@non.com> scripsit:
What would you expect to be placed in the textbox? The file name only?
Have a look at the CommonDialog's 'FileTitle' property.
I did answer this post, Armin did give an addition to that post and than
again Herfried
start using a better newsreader Herfried.


Yep... I am still looing for a better newsreader.
The OP did write

The following code is
supposed to open a simple text file I created - putting
the text into my VB text box.


Ah---he wants to put the text of the selected file into the textbox...

A nice procedure for doing that can be found here (ignore the German
language comments):

<http://www.vbtec.de/readfile.htm>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
Cor
Hi Herfried,

Yep... I am still looing for a better newsreader.

I never visited this newsgroup but if you are able to look in china for some
information, this is maybe a good newsgroup for you.

nl.comp.software.newsreaders

If your newsserver does not give that newsgroup, you can look on this free
newsserver

news.readfreenews.net use port 120

:-)))))

Cor
Nov 20 '05 #7
* "Cor" <no*@non.com> scripsit:
Yep... I am still looing for a better newsreader.


I never visited this newsgroup but if you are able to look in china for some
information, this is maybe a good newsgroup for you.


There are lots of newsreaders available, each of them with its
advantages and disadvantages. I chose the _IMHO_ best newsreader, but
it has some disadvantages too...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
Cor
Herfried,

But maybe you can ask that in the newsgroup I did supply

And when you tell you don't speak the language for that newsgroup, you can
do it in English or German also I gues.

Cor
Nov 20 '05 #9
* "Cor" <no*@non.com> scripsit:
But maybe you can ask that in the newsgroup I did supply

And when you tell you don't speak the language for that newsgroup, you can
do it in English or German also I gues.


I don't have any questions.

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #10
Cor
>
I don't have any questions.

You did send this to this newsgroup
Yep... I am still looing for a better newsreader.
(I understand that looing is a typo for looking)


Are you looking or not looking, so when you are looking you need advice.

And for that I did give you a newsgroup that is better for this problem..

:-)))

Cor
Nov 20 '05 #11
* "Cor" <no*@non.com> scripsit:
I don't have any questions.


You did send this to this newsgroup
Yep... I am still looing for a better newsreader.
(I understand that looing is a typo for looking)


Are you looking or not looking, so when you are looking you need advice.

And for that I did give you a newsgroup that is better for this problem..


:-()

It was not a question. I have worked with lots of different newsreaders
and I have taken my decision.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MR BIGLESWORTH | last post by:
Hi, I have A FileOpen command that opens A file outside of the local folder (where my program is). That works fine, but; I want to create a file in the local folder after that 1st file is opened,...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
0
by: Wendy Attenberger | last post by:
We are using the FileOpen method to read through a .css file. It is dropping the period in front of a .css class name. (whenever the line begins with a period...it just drops it.) FYI...It...
2
by: zurg | last post by:
Hi! I have a specific problem - I need to take some informations from a .txt file from another computer... I use OpenFile and the program runs perfectly... But when I run it second time I get an...
0
by: jharikrishna | last post by:
How to use filestreams in c# How to open the fileopen window how to read the text in that file.
0
by: Subhankar | last post by:
Hi, I am trying to open a MS Project residing in a MS SQL Server. I have the following code for the FileOpen: projectApp.FileOpen("<ChouOister>\\Test Project 2", false, 0, null, null, null,...
2
latitude
by: latitude | last post by:
Hi, having a problem with streamreader im not to sure how to solve. I have made a text editor, now what i'd like it to do is when i click a textfile in windows - the program opens automatically and...
1
by: ckb | last post by:
Hi, I need to get the fileopen saveas dialogbox in javascript.I have used the but i want to extract the location ang the file name that the user chooses in my code for further processing once the...
2
by: keane | last post by:
i have using one batch file in my VB.NET bin Directory, it loads when form load event. The Output from the batch file stored into some log file.when i am going to write those results by using...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...
0
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...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.