glynns10

i'm a rookie at this and i'm haveing a hard time doing two things...

i have created a form , with textboex, ext, i want to know how do i save this so i can print the form out can anyone please walk me step by step through this

i also would like to setup the print function also, step by step, i know i'm a pain, but could soneone please take the time to explaing this to me .

i have downloaded some stuff on how to creat a form, put buttons(some) on it, add text boxes, and this is fun, i created a work sheet form, and it works great, but i can't figure out how to put the save buttons and print button on so they will work....



Re: Visual Basic Express Edition hi i'm back and this program is killing me...can anyone help me

Frank Boyne

glynns10 wrote:
how do i save this so i can print the form out

I'm not sure I understand the question. The word "save" generally implies storing the contents in a disk file or some other less volatile medium. You shouldn't need to save the contents of a form just to be able to print the form (unless you have some additional printing requirements that impose this restriction )

i also would like to setup the print function also, step by step

A good place to start with a question like that is the Web. Microsoft's various evangelism groups do a pretty good job of publishing example code, explanatory articles and walkthroughs. Often the challenge is finding them.

This search for example: http://www.google.com/search q=Form+print+site%3Amicrosoft.com&rls=com.microsoft:en-us&ie=UTF-8&oe=UTF-8&startIndex=&startPage=1 looks for pages containing the words 'Form' and 'Print' on a server within the Microsoft domain. We're not often this lucky (and your mileage may vary) but the first hit on my results page was this one: http://msdn2.microsoft.com/en-us/library/xdt36c58.aspx.

The link "How To: print a Windows Form" might be a good place to start. If you want to to provide a more fully-featured printing capability some of the other links explain how to show the printer selection dialog and retrieve input from the user (to control Duplex or which printer you print on etc.) and how to do other things that are printing related.

If all that doesn't cover everything you need maybe some of the other hits on the Google search will help.





Re: Visual Basic Express Edition hi i'm back and this program is killing me...can anyone help me

Solitaire

An easy way to print the form:

Run the program and stop at the point where you want to print what you see.

Press Alt-PrintScreen. This copies the active form to the clipboard.

Start WORD or another program. Click Edit/Paste. The form will be printed to your document.






Re: Visual Basic Express Edition hi i'm back and this program is killing me...can anyone help me

glynns10

when i mean save, i'm sorry for not taking the time to explain it....on my form is info, that i can change when i need to like a spreadsheet. what i'd like to do is find out how can i save this file so i can view\print it later my form has day,dollar amounts of info that changes.




Re: Visual Basic Express Edition hi i'm back and this program is killing me...can anyone help me

Karl Davies-Barrett - MCT

This post has a simlar theme and the printform componet from MS is great, since it comes with a good tutorial on how to use it step by step. http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1714271&SiteID=1

Regarding the saving, Either a text file or a database, depends how many records and how much flexibility. If you will be saving the whole lot and reading it ALL back in again, then a text file will do. Just rememeber to read in the order you wrote.

Code Snippet

Dim sw as system.io.streamwriter("MyFile.dat",false)

' False will mean that you overwrite the whole lot each time, make sure to wrtie it all.

sw.Writeline(textbox1.text)

sw.close

to read put a button, get data:

Code Snippet

Dim sr as system.io.streamreader("MyFile.dat")

sr.lineline(textbox1.text)

sw.close

You will need a loop to read everything (do while sr.peek <> -1)

or use

Code Snippet

dim mydata as string

Mydata = sr.readToEnd

But then you have to chop it up manually and put it back in the right places on the form

Hopefully that's enoough to get you started !!






Re: Visual Basic Express Edition hi i'm back and this program is killing me...can anyone help me

Frank Boyne

The topic of storing application data into a data file can rapidly grow to consume all your available time - binary data or text Ascii or Unicode Raw text or Formatted text Open Document Format or OpenXML

I think this article does a pretty good job of describing one approach: Creating Document-Centric Applications in Windows Forms, Part 1
http://msdn2.microsoft.com/en-us/library/ms951217.aspx