 |
|
|
|
| Author |
Message |
Derik
Joined: 22 Dec 2007 Posts: 5
|
Posted: Sat Dec 22, 2007 2:53 am Post subject: Coding a save button |
|
|
How would i code a save button in VB6?
Archived from group: microsoft>public>vb>syntax |
|
| Back to top |
|
 |
MikeD
Joined: 04 Oct 2007 Posts: 3348
|
Posted: Sat Dec 22, 2007 1:29 pm Post subject: Re: Coding a save button |
|
|
"Derik" wrote in message @TK2MSFTNGP02.phx.gbl...
> How would i code a save button in VB6?
You're gonna have to provide a lot more details. What do you want to save?
In what format do you want it saved? Just a simple text file like an CSV?
Other things to you need to take into consideration are what data you need
to save, how much data you need to save, how are you going to use this data,
etc., etc.
--
Mike
Microsoft MVP Visual Basic |
|
| Back to top |
|
 |
Larry Serflaten
Joined: 04 Oct 2007 Posts: 2644
|
Posted: Sat Dec 22, 2007 5:20 pm Post subject: Re: Coding a save button |
|
|
"Derik" wrote
> How would i code a save button in VB6?
Double click a command button on the toolbar. That will place
a button on a form.
Double click the new command button. That will take you to the
Click event for that button.
Add the code to open, write, and close your file. That is all there
is to it.
If you need more details, see MikeD's reply.
LFS |
|
| Back to top |
|
 |
Derik
Joined: 22 Dec 2007 Posts: 5
|
Posted: Sat Dec 22, 2007 6:53 pm Post subject: Re: Coding a save button |
|
|
I need to save a text file. I am in a class at school and I'm making a
project that uses tabs. I have to be able to add tabs to the project by
clicking on the Add Product menu. I also have to be able to save the
changes made to the tabs. The project is loading the tabs from a text
file by using a control array. Any thoughts?
MikeD wrote:
> "Derik" wrote in message
> @TK2MSFTNGP02.phx.gbl...
>> How would i code a save button in VB6?
>
> You're gonna have to provide a lot more details. What do you want to save?
> In what format do you want it saved? Just a simple text file like an CSV?
> Other things to you need to take into consideration are what data you need
> to save, how much data you need to save, how are you going to use this data,
> etc., etc.
> |
|
| Back to top |
|
 |
MikeD
Joined: 04 Oct 2007 Posts: 3348
|
Posted: Sat Dec 22, 2007 7:05 pm Post subject: Re: Coding a save button |
|
|
"Derik" wrote in message @TK2MSFTNGP03.phx.gbl...
>I need to save a text file. I am in a class at school and I'm making a
>project that uses tabs. I have to be able to add tabs to the project by
>clicking on the Add Product menu. I also have to be able to save the
>changes made to the tabs. The project is loading the tabs from a text file
>by using a control array. Any thoughts?
Talk to your instructor. He/She has probably outlined, at least to some
degree, how he/she wants you to do these things.
--
Mike
Microsoft MVP Visual Basic |
|
| Back to top |
|
 |
MikeD
Joined: 04 Oct 2007 Posts: 3348
|
Posted: Sat Dec 22, 2007 7:07 pm Post subject: Re: Coding a save button |
|
|
"Larry Serflaten" wrote in message @TK2MSFTNGP03.phx.gbl...
>
> "Derik" wrote
>> How would i code a save button in VB6?
>
> Double click a command button on the toolbar.
Er....toolbox....not toolbar.
--
Mike
Microsoft MVP Visual Basic |
|
| Back to top |
|
 |
Derik
Joined: 22 Dec 2007 Posts: 5
|
Posted: Sat Dec 22, 2007 8:03 pm Post subject: Re: Coding a save button |
|
|
Well yeah he did, but i was wondering if there was a really easy way to
do it. I also have to have a file menu with exit in it, and the exit
button must prompt to save before exiting. Thanx for your time.
MikeD wrote:
> "Derik" wrote in message
> @TK2MSFTNGP03.phx.gbl...
>> I need to save a text file. I am in a class at school and I'm making a
>> project that uses tabs. I have to be able to add tabs to the project by
>> clicking on the Add Product menu. I also have to be able to save the
>> changes made to the tabs. The project is loading the tabs from a text file
>> by using a control array. Any thoughts?
>
>
> Talk to your instructor. He/She has probably outlined, at least to some
> degree, how he/she wants you to do these things.
> |
|
| Back to top |
|
 |
"Rick Rothstein \
Joined: 04 Oct 2007 Posts: 1584
|
Posted: Sat Dec 22, 2007 9:42 pm Post subject: Re: Coding a save button |
|
|
>>
>>> I need to save a text file. I am in a class at school and I'm making a
>>> project that uses tabs. I have to be able to add tabs to the project by
>>> clicking on the Add Product menu. I also have to be able to save the
>>> changes made to the tabs. The project is loading the tabs from a text
>>> file by using a control array. Any thoughts?
>>
>>
>> Talk to your instructor. He/She has probably outlined, at least to some
>> degree, how he/she wants you to do these things.
>
> Well yeah he did, but i was wondering if there was a really easy way to do
> it. I also have to have a file menu with exit in it, and the exit button
> must prompt to save before exiting. Thanx for your time.
My two cents worth:
You should not be looking for "easy" ways to do things at this stage of your
learning. The time to learn the kind of tricks I think you are asking about
is AFTER you learn the fundamentals well enough that you can use them as if
they were second nature to you. Follow the instructions the teacher has
given you and learn to do what he/she is teaching you well; there is usually
a good reason for an instructor teaching things in the order he/she is doing
it and for the homework assignments he/she gives you (that is true no matter
what the class)... don't try to skip ahead of the instructor, it will not
help you learn the fundaments that you need in order to advance to the next
levels.
Rick |
|
| Back to top |
|
 |
MikeD
Joined: 04 Oct 2007 Posts: 3348
|
Posted: Sun Dec 23, 2007 1:36 am Post subject: Re: Coding a save button |
|
|
"Rick Rothstein (MVP - VB)" wrote in
message @TK2MSFTNGP06.phx.gbl...
> >>
>
FYI to Derik...
Bottom posting is generally preferred because it maintains the "flow" of the
quoted conversation. IOW, you read the quotes from the earliest (top) to the
latest (bottom). Most people don't really care too much if a thread is
started as top-posted or bottom-posted, but whichever method is started in a
reply, it should be followed in all subsequent replies.Otherwise, it just
makes a mess of quoted text unless somebody takes the time to fix it like
Rick did. If you're unsure what top-posting and bottom-posting mean,
top-posting is when your reply precedes quoted text (is on "top" of it) and
bottom-posting is when your reply follows quoted text (is at the "bottom" of
it). Frequently (as I'm doing in this message), you have "inline" comments
but even then, the comment usually is under the quote (so is bottom-posted).
>>>> I need to save a text file. I am in a class at school and I'm making a
>>>> project that uses tabs. I have to be able to add tabs to the project by
>>>> clicking on the Add Product menu. I also have to be able to save the
>>>> changes made to the tabs. The project is loading the tabs from a text
>>>> file by using a control array. Any thoughts?
>>>
>>>
>>> Talk to your instructor. He/She has probably outlined, at least to some
>>> degree, how he/she wants you to do these things.
>>
>> Well yeah he did, but i was wondering if there was a really easy way to
>> do it. I also have to have a file menu with exit in it, and the exit
>> button must prompt to save before exiting. Thanx for your time.
>
> My two cents worth:
>
> You should not be looking for "easy" ways to do things at this stage of
> your learning. The time to learn the kind of tricks I think you are asking
> about is AFTER you learn the fundamentals well enough that you can use
> them as if they were second nature to you. Follow the instructions the
> teacher has given you and learn to do what he/she is teaching you well;
> there is usually a good reason for an instructor teaching things in the
> order he/she is doing it and for the homework assignments he/she gives you
> (that is true no matter what the class)... don't try to skip ahead of the
> instructor, it will not help you learn the fundaments that you need in
> order to advance to the next levels.
>
I agree with Rick 100%. When you're first learning a programming language
(or really anything at all), you need to stick to the basics and if not
master at least be very familiar and comfortable with. And really, that's
what your instructors wants, especially if it's an introductory class (and
it sounds like this is). There's nothing wrong with wanting to learn more
and being aggressive in your coding, but if you come to the newsgroups
asking how you can do something...shall we say in a "more advanced way",
your instructor is either going to be wondering why you're taking this class
or he/she is going to know you didn't do the project all on your own (and
probably give you a lesser grade on it). You need to keep with the lesson
that the instructor is teaching, not ask in the newsgroups how to do the
project in an advanced way. That's the LAST thing an instructor wants to see
in their students. You're not going to impress your instructor by writing
code and using techniques that have not been discussed in class. He/She is
just going to know you got help or possibly that someone else wrote most of
the code.
--
Mike
Microsoft MVP Visual Basic |
|
| Back to top |
|
 |
Derik
Joined: 22 Dec 2007 Posts: 5
|
Posted: Sun Dec 23, 2007 2:22 am Post subject: Re: Coding a save button |
|
|
MikeD wrote:
> "Rick Rothstein (MVP - VB)" wrote in
> message @TK2MSFTNGP06.phx.gbl...
>> >>
>>
>
> FYI to Derik...
>
> Bottom posting is generally preferred because it maintains the "flow" of the
> quoted conversation. IOW, you read the quotes from the earliest (top) to the
> latest (bottom). Most people don't really care too much if a thread is
> started as top-posted or bottom-posted, but whichever method is started in a
> reply, it should be followed in all subsequent replies.Otherwise, it just
> makes a mess of quoted text unless somebody takes the time to fix it like
> Rick did. If you're unsure what top-posting and bottom-posting mean,
> top-posting is when your reply precedes quoted text (is on "top" of it) and
> bottom-posting is when your reply follows quoted text (is at the "bottom" of
> it). Frequently (as I'm doing in this message), you have "inline" comments
> but even then, the comment usually is under the quote (so is bottom-posted).
>
>>>>> I need to save a text file. I am in a class at school and I'm making a
>>>>> project that uses tabs. I have to be able to add tabs to the project by
>>>>> clicking on the Add Product menu. I also have to be able to save the
>>>>> changes made to the tabs. The project is loading the tabs from a text
>>>>> file by using a control array. Any thoughts?
>>>>
>>>> Talk to your instructor. He/She has probably outlined, at least to some
>>>> degree, how he/she wants you to do these things.
>>> Well yeah he did, but i was wondering if there was a really easy way to
>>> do it. I also have to have a file menu with exit in it, and the exit
>>> button must prompt to save before exiting. Thanx for your time.
>> My two cents worth:
>>
>> You should not be looking for "easy" ways to do things at this stage of
>> your learning. The time to learn the kind of tricks I think you are asking
>> about is AFTER you learn the fundamentals well enough that you can use
>> them as if they were second nature to you. Follow the instructions the
>> teacher has given you and learn to do what he/she is teaching you well;
>> there is usually a good reason for an instructor teaching things in the
>> order he/she is doing it and for the homework assignments he/she gives you
>> (that is true no matter what the class)... don't try to skip ahead of the
>> instructor, it will not help you learn the fundaments that you need in
>> order to advance to the next levels.
>>
>
> I agree with Rick 100%. When you're first learning a programming language
> (or really anything at all), you need to stick to the basics and if not
> master at least be very familiar and comfortable with. And really, that's
> what your instructors wants, especially if it's an introductory class (and
> it sounds like this is). There's nothing wrong with wanting to learn more
> and being aggressive in your coding, but if you come to the newsgroups
> asking how you can do something...shall we say in a "more advanced way",
> your instructor is either going to be wondering why you're taking this class
> or he/she is going to know you didn't do the project all on your own (and
> probably give you a lesser grade on it). You need to keep with the lesson
> that the instructor is teaching, not ask in the newsgroups how to do the
> project in an advanced way. That's the LAST thing an instructor wants to see
> in their students. You're not going to impress your instructor by writing
> code and using techniques that have not been discussed in class. He/She is
> just going to know you got help or possibly that someone else wrote most of
> the code.
>
well the thing is my instructor has already told me how to do it im just
wondering if there is an easier way to do it than what he taught me? |
|
| Back to top |
|
 |
"Rick Rothstein \
Joined: 04 Oct 2007 Posts: 1584
|
Posted: Sun Dec 23, 2007 4:56 am Post subject: Re: Coding a save button |
|
|
>> Bottom posting is generally preferred because it maintains the "flow" of
>> the quoted conversation. IOW, you read the quotes from the earliest (top)
>> to the latest (bottom). Most people don't really care too much if a
>> thread is started as top-posted or bottom-posted, but whichever method is
>> started in a reply, it should be followed in all subsequent
>> replies.Otherwise, it just makes a mess of quoted text unless somebody
>> takes the time to fix it like Rick did. If you're unsure what top-posting
>> and bottom-posting mean, top-posting is when your reply precedes quoted
>> text (is on "top" of it) and bottom-posting is when your reply follows
>> quoted text (is at the "bottom" of it). Frequently (as I'm doing in this
>> message), you have "inline" comments but even then, the comment usually
>> is under the quote (so is bottom-posted).
>>
>>>>>> I need to save a text file. I am in a class at school and I'm making
>>>>>> a project that uses tabs. I have to be able to add tabs to the
>>>>>> project by clicking on the Add Product menu. I also have to be able
>>>>>> to save the changes made to the tabs. The project is loading the tabs
>>>>>> from a text file by using a control array. Any thoughts?
>>>>>
>>>>> Talk to your instructor. He/She has probably outlined, at least to
>>>>> some degree, how he/she wants you to do these things.
>>>> Well yeah he did, but i was wondering if there was a really easy way to
>>>> do it. I also have to have a file menu with exit in it, and the exit
>>>> button must prompt to save before exiting. Thanx for your time.
>>> My two cents worth:
>>>
>>> You should not be looking for "easy" ways to do things at this stage of
>>> your learning. The time to learn the kind of tricks I think you are
>>> asking about is AFTER you learn the fundamentals well enough that you
>>> can use them as if they were second nature to you. Follow the
>>> instructions the teacher has given you and learn to do what he/she is
>>> teaching you well; there is usually a good reason for an instructor
>>> teaching things in the order he/she is doing it and for the homework
>>> assignments he/she gives you (that is true no matter what the class)...
>>> don't try to skip ahead of the instructor, it will not help you learn
>>> the fundaments that you need in order to advance to the next levels.
>>>
>>
>> I agree with Rick 100%. When you're first learning a programming language
>> (or really anything at all), you need to stick to the basics and if not
>> master at least be very familiar and comfortable with. And really,
>> that's what your instructors wants, especially if it's an introductory
>> class (and it sounds like this is). There's nothing wrong with wanting to
>> learn more and being aggressive in your coding, but if you come to the
>> newsgroups asking how you can do something...shall we say in a "more
>> advanced way", your instructor is either going to be wondering why you're
>> taking this class or he/she is going to know you didn't do the project
>> all on your own (and probably give you a lesser grade on it). You need
>> to keep with the lesson that the instructor is teaching, not ask in the
>> newsgroups how to do the project in an advanced way. That's the LAST
>> thing an instructor wants to see in their students. You're not going to
>> impress your instructor by writing code and using techniques that have
>> not been discussed in class. He/She is just going to know you got help or
>> possibly that someone else wrote most of the code.
>>
> well the thing is my instructor has already told me how to do it im just
> wondering if there is an easier way to do it than what he taught me?
The one thing I have found in VB is that there seems to always be another
way to do something. However, you have to take care in using "easier"
solutions because, very often, they are less efficient that a longer looking
process. For example, there are API function solutions that will take up
many, many lines to implement which will run circles around much shorter
routines. Take a look at this link...
http://www.xbeat.net/vbspeed/c_GetFile.htm
Scroll down about a third of the way to the speed comparison chart. Take a
look at the code labeled GetFile05... it is the fastest for the function
being tested with all the others taking more than twice as long to execute.
Just under the chart are listing for the five routines. Notice how short the
first four listing are (between 7 and 13 lines of active code). Now look at
the code for the fastest routine... it is some 70 to 80 lines long
consisting of some 7 individual procedures.
As I said earlier... learn the basics and forget about looking for easier,
or even faster, routines... doing that will serve you best as you study VB.
Rick |
|
| Back to top |
|
 |
Larry Serflaten
Joined: 04 Oct 2007 Posts: 2644
|
Posted: Sun Dec 23, 2007 5:30 am Post subject: Re: Coding a save button |
|
|
"Derik" wrote
> well the thing is my instructor has already told me how to do it im just
> wondering if there is an easier way to do it than what he taught me?
There may be.
But you should consider, the only way to know which way is easiest
is to try them all and make the determination. People in the newsgroups
often have experience with more than one way to do a (somewhat) common
task. That is because (before they knew better) they tried different ways to
do that task. While still 'learning', they had to work from their ideas on how
to solve the problem, and sometimes doing work in other areas helps them to
see a different approach. When a new task comes along, they are able to
draw on their experience to determine an appropreate plan of attack. But a
student who has little to no experience still has to figure it out for themselves.
The research and thought processes it takes to solve the problem is the more
important lesson than trying to read a file, or create an array. The ability to
look at a problem and come up with a *working* solution (whether hard, easy,
or whatever else) is the skill the school is trying to teach you, even if they
tell you how to do it, before they give you the problem....
Like everything else, problem solving skills require practice. You have to apply
yourself to the task to develop the skill. Any one can jump in a newsgroup and
copy code (or ideas) from someone else. Developing your own code (eg. ideas,
algorithms, and solutions) is what is going to set you apart from the others....
Newsgroups are a big help when you don't have an instructor, or mentor, to
point the way to a solution. When a person gets off into uncharted territory
(at least for them) it is a big help to ask if anyone else has done a similar task,
to get a few pointers and links to research and learn from.
When you're working on school cirriculum, pick the instructor's brain who is
already familiar with the task and your own level of experience. When you
start on your own projects, then drop by and post a few specific questions
to the newsgroups. Be sure you take the time to understand the code you
use, otherwise, you end up with 'black box' code which you won't know how
to fix, if and when it breaks....
Good luck!
LFS |
|
| Back to top |
|
 |
Karl E. Peterson
Joined: 04 Oct 2007 Posts: 4836
|
Posted: Wed Jan 02, 2008 9:58 pm Post subject: Re: Coding a save button |
|
|
Derik wrote:
> well the thing is my instructor has already told me how to do it im just
> wondering if there is an easier way to do it than what he taught me?
Easiest way is to use a name like "Suzy" or "Heidi" or "Debbie" (you see the
pattern, right?) when you post. HTH!
--
..NET: It's About Trust!
http://vfred.mvps.org
|
|
| Back to top |
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|