Question Adding multiple text files to project

PMac

Member
Joined
Feb 17, 2012
Messages
11
Programming Experience
Beginner
Hi all, I'm new to this forum, but I've been using it for quite some time for help with the project I'm working on.

I'm quite new to VB.NET as well, so pardon me if some of my questions seem a little basic..

In the project I'm currently working on, there is a part where the user makes selections from some comboboxes (5 in total), and then clicks a button. Once this button is clicked, depending on the selections the user has made, there is going to be different information displayed in a text box (There are 504 possible combinations of selections all together, and each will display a different block of text). As well as pictures, and some other different information.

So far I have the pictures working based on the combinations the user selects, but I'm having trouble figuring out the best way to display the text information (which is the most important part of the information). Right now I have 504 dummy text files, that I still need to fill in with the proper information, all with their names corresponding to the string I would like them to be referred to as, but my knowledge is very limited as far as the best way to incorporate this text into my project.

The text will be formatted, and fairly long (A few paragraphs or so) I know I could go through all 504 different combinations and simply cut and paste the text into the Me.Textbox.Text = "Insert desired text here" ​for each instance, but that will be extremely time consuming, not to mention clutter up my code like crazy.

I've looked at a few different tutorials, but am still at a loss on how to import my text into a database and then access the database and show the desired section of text when the user makes their selections.

I think a database would be the best way to accomplish my goal, but am not 100% sure. Any help with this would be greatly appreciated, as I don't really want to clutter up my code with 504 blocks of un-needed text, and I also don't want to have to distribute my program with a folder containing all the individual text files, I'd much rather have it all contained in the build.

Thanks,

Patrick

PS Sorry for the extremely long post, but I wanted to give as much detail as I could
 
I've normally worked with databases for business applications so your program and intention is a bit strange and new to me. But I'll give you my personal opinion. I think it may be best to use a database to store the text if they are lengthy as you say. I suppose 2 fields would do. A simple table structure would be ID and Text. You can use the data type text to store text data in it. (ntext, text, and image (Transact-SQL))
 
That does sound like it would be the best route for me, but I'm having a lot of trouble trying to translate the database tutorials I've found into something that will work for my project. Is there anyone that could explain, or point me to a tutorial that would explain how to create and use a database in vb that a relative novice could understand? I know that's probably asking a lot, not looking for anyone to hold my hand while I do this, it's just trying to decipher all the information available on here about creating a database is very overwhelming to me haha.

PS I've started moving my texts files into a CSV using Excel, not sure if that's the proper way to do this, but I don't have SQL, so I thought it would be my next best bet.
 
try these links..

if you don't have MS SQL Server, then I think you should get it first. This is the download link for the free express edition. its a stripped down version of the commercial version but offers enough functions for your program, I think. (Download: Microsoft SQL Server 2008 Express - Microsoft Download Center - Download Details) Installing it can be a bit overwhelming for a beginner so here's a tutorial on how to do that too. (Learn how to install SQL Server 2008 Express | MacLochlainns Weblog)

For SQL Server basics, (creating databases/Tables etc) you should check out this one. (SQL Server Tutorial)

And finally for connecting your application to the database, spend some time checking this out. (Data Walkthroughs)
I think you might wanna read under Connecting to Data in a SQL Server Express Database (Windows Forms) in particular.


Do a lot of research, study, read and get started on it. If you hit snags, post them here with the code and the error messages you're getting.

Good Luck!
 
I'll have to check that stuff out when I've got some more time.

Thanks a lot for the help nK0de!
 
Back
Top