473,322 Members | 1,408 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,322 software developers and data experts.

Build a Program Now! VB2005

Hi -

On page 78 of the book
Build a program Now!
Microsoft Visual Basic 2005
Express Edition

I was following the instructions, the book told me to insert code using
code snippets. However the code that got inserted looks different from
the code on the listing in the text. Just wondering if the book is
wrong or I am...would appeciate someone's opinion...

If this isn't the right forum, could someone tell me where to post?

Thanks!

Joy

*** Sent via Developersdex http://www.developersdex.com ***
Sep 20 '06 #1
4 1771
Joy,

There is maybe something in the book from a Beta version. But what is the
problem, the snippets can be changed everytime with every update as well by
yourself.

Because most of us are not reading beginner books or it are those who cannot
help you, has it in my idea no sense to tell us on what page from a beginner
book something is.

Just show the code as it is in the book and is in the snippet, than we can
tell you if it hurts or just is a newer implementation.

Cor

"Joy M" <ab***@ns.sympatico.caschreef in bericht
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hi -

On page 78 of the book
Build a program Now!
Microsoft Visual Basic 2005
Express Edition

I was following the instructions, the book told me to insert code using
code snippets. However the code that got inserted looks different from
the code on the listing in the text. Just wondering if the book is
wrong or I am...would appeciate someone's opinion...

If this isn't the right forum, could someone tell me where to post?

Thanks!

Joy

*** Sent via Developersdex http://www.developersdex.com ***

Sep 20 '06 #2
Joy
Hi Cor -

Thanks for writing.

The book has 'finished code' for all the problems.

Here is the 'finished code' supposedly supplied when you hit Insert
Snippet Processing Drives, Folders and Files Write Text to a File :

=-=-=-=-

Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object,
ByVal e As _
System.ComponentModel.CancelEventArgs) Handles
SaveFileDialog1.FileOk
Try
' The property FileName from the first argument in
WriteAllText refers to
' the FileName selected by the user in the SaveFileDialog1
' Then we are passing the content of each TextBox and
concatenating the
' Carriage Return-Line Feed constant
' The last parameter indicated if we should append to a file
if it
' exists. False will not and therefore recreate the file
each time.
' In order to add the content of the first box we need to
put true for
' the 2d and 3rd write otherwise only the last one would be
there
' if they were both true.

My.Computer.FileSystem.WriteAllText(Me.SaveFileDia log1.FileName, _
Me.tbMessage.Text & vbCrLf, False)

My.Computer.FileSystem.WriteAllText(Me.SaveFileDia log1.FileName, _
Me.TextBox2.Text & vbCrLf, True)

My.Computer.FileSystem.WriteAllText(Me.SaveFileDia log1.FileName, _
Me.TextBox3.Text & vbCrLf, True)
Catch fileException As Exception
Throw fileException
End Try
End Sub

=-=-=-=

As for me, this is the code snippet that was pasted when I created the
application

Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object,
ByVal e As System.ComponentModel.CancelEventArgs) Handles
SaveFileDialog1.FileOk
My.Computer.FileSystem.WriteAllText("C:\Test.txt", "Text", True)
End Sub

=-=-=-=

What the application does is save the contents of 3 textboxes to a file,
so you can see it.

Something is weird. I hope you can help me straighten this out!

Thanks for helping,

Joy

*** Sent via Developersdex http://www.developersdex.com ***
Sep 20 '06 #3

Joy wrote:
Hi Cor -

Thanks for writing.

The book has 'finished code' for all the problems.

Here is the 'finished code' supposedly supplied when you hit Insert
Snippet Processing Drives, Folders and Files Write Text to a File :

=-=-=-=-

Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object,
ByVal e As _
System.ComponentModel.CancelEventArgs) Handles
SaveFileDialog1.FileOk
Try
' The property FileName from the first argument in
WriteAllText refers to
' the FileName selected by the user in the SaveFileDialog1
' Then we are passing the content of each TextBox and
concatenating the
' Carriage Return-Line Feed constant
' The last parameter indicated if we should append to a file
if it
' exists. False will not and therefore recreate the file
each time.
' In order to add the content of the first box we need to
put true for
' the 2d and 3rd write otherwise only the last one would be
there
' if they were both true.

My.Computer.FileSystem.WriteAllText(Me.SaveFileDia log1.FileName, _
Me.tbMessage.Text & vbCrLf, False)

My.Computer.FileSystem.WriteAllText(Me.SaveFileDia log1.FileName, _
Me.TextBox2.Text & vbCrLf, True)

My.Computer.FileSystem.WriteAllText(Me.SaveFileDia log1.FileName, _
Me.TextBox3.Text & vbCrLf, True)
Catch fileException As Exception
Throw fileException
End Try
End Sub

=-=-=-=

As for me, this is the code snippet that was pasted when I created the
application

Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object,
ByVal e As System.ComponentModel.CancelEventArgs) Handles
SaveFileDialog1.FileOk
My.Computer.FileSystem.WriteAllText("C:\Test.txt", "Text", True)
End Sub

=-=-=-=

What the application does is save the contents of 3 textboxes to a file,
so you can see it.

Something is weird. I hope you can help me straighten this out!
There is no way the snippet could know you have any text boxes to
output so it shows a basic example of how to write text to a file and
it seems fine to me. You probably need to just add the code for the
text boxes.

Don't get bogged down by what the book says you should see or if the
snippet is slightly different. If you understand the concepts then, if
the book is wrong, you will be able to correct the code yourself. You
may have to go to sources outside the book on occaision if something
doesn't look right to you.

Sep 20 '06 #4
Joy,
>
The book has 'finished code' for all the problems.
Completely agreeing with Chris; I only will add that you will probably have
much disappointments in your future life as developer. Almost every good
developer tells that he knows no problems, only challenges but on the route
to the solution to that the will always meet a lot of problems to be solved.

(And therefore he is a developer and not a bookkeeper.)

:-)

Just my thought,

Cor
Sep 21 '06 #5

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

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
0
by: Rob Young | last post by:
This is the latest in the "Total Non-Programmer" series. Any feedback on the usability of this tutorial would be greatly appreciated. Thanks, Rob How to Build A Web Database (Without...
8
by: Mav | last post by:
Hi, all I wonder is that any way to estimate the build time from VS.net(C++ project). We have a lot of projects(40) under one single solution. We use the command line (devenv.exe...
2
by: Felix | last post by:
Out of no where I'm starting to get these problems and my Deployment projects won't build anymore. Does anyone have any idea what's causing this? I've tried copying these files from another...
7
by: teliot | last post by:
I'm just starting to use VWD Express. Supposedly, if I use a separate file (code behind) for my web forms, it should build them into a DLL into the Bin folder. However, no bin folder was...
3
by: michael.lang | last post by:
I am using PostBuild events in a C# project to run some tasks, but only when in release configuration mode. The build events run perfectly as expected when run. The problem comes when I save the...
9
by: yevvi | last post by:
Hi, We have a product with bunch of dlls which are now built with Visual Studio 2003. We want to switch the build to use VS2005. I have read that in VS2005 runtime libraries come as...
4
by: nmrcarl | last post by:
I'm trying to upgrade a large project from VS 6.0 to VS 2005. After fixing a lot of things that changed (mostly sloppy coding in the original project that VS2005 didn't allow), I got the release...
15
by: Charles Law | last post by:
In the build output appears ========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ========== However, the compiler does not generate any errors, and the Errors list is empty. This is an...
5
by: Break2 | last post by:
I am new to C++ and have learned that when I build a program and I want to learn how, it is best to build each program according to the same standard. In my programs I want to have a function...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.