C# - I'm desprate at this point.

LBJuice

n00b
Joined
Jan 23, 2005
Messages
27
Background:
I'm building an application that will be used to generate home inspection reports. The inspectors must answer typical questions about specific aspects of the house, and then they typically leave comments about certain characteristics such as: Porch Need Railings, Secure loose whatevers.

I plan to make it so the main application window will display the mandatory assessment fields like number of bath rooms, overall basement condition, etc. and then have a button that launches a new form window for comments. This new window will consist of a checklistbox of presents (Comments made often) and at the bottom maybe a rich text box to add specific or unusual comments (such as basement contains dead hookers - recommend remove). Or possibly do a list box that when an item is double clicked it'd add them to the rich text box.

I think it should be cut and dry for the most part but I have a couple questions:

( 1 ) How do you store data in C#? I want to be able to easily add new presets - I would like to use datasets because they make sense to me as I debt with MySQL when I designed websites. I do not want the client to have to install any kind of database application, If I use datasets would it require them to? Is there a better way?

( 2 ) How would I pass that dataset through a constructor so that when the new form is called it can look at the data sent to it and organize it in its checklistbox?

( 3 ) How do I should I store all the selected data until I need to call them and organize them in a Word document? (Needed ultimately in an array)?

( 4 ) Is there a better way to do this?! If you had to build a Windows App. Form with a ton of checkboxes and data how would you approach it conceptually?
 
Background:
I'm building an application that will be used to generate home inspection reports. The inspectors must answer typical questions about specific aspects of the house, and then they typically leave comments about certain characteristics such as: Porch Need Railings, Secure loose whatevers.

I plan to make it so the main application window will display the mandatory assessment fields like number of bath rooms, overall basement condition, etc. and then have a button that launches a new form window for comments. This new window will consist of a checklistbox of presents (Comments made often) and at the bottom maybe a rich text box to add specific or unusual comments (such as basement contains dead hookers - recommend remove). Or possibly do a list box that when an item is double clicked it'd add them to the rich text box.

I think it should be cut and dry for the most part but I have a couple questions:

( 1 ) How do you store data in C#? I want to be able to easily add new presets - I would like to use datasets because they make sense to me as I debt with MySQL when I designed websites. I do not want the client to have to install any kind of database application, If I use datasets would it require them to? Is there a better way?

( 2 ) How would I pass that dataset through a constructor so that when the new form is called it can look at the data sent to it and organize it in its checklistbox?

( 3 ) How do I should I store all the selected data until I need to call them and organize them in a Word document? (Needed ultimately in an array)?

( 4 ) Is there a better way to do this?! If you had to build a Windows App. Form with a ton of checkboxes and data how would you approach it conceptually?

I think I understand your thinking on simplicity -- Just "run this *.exe file" to run the app without needing install shield, database app installs, etc. I'm also assuming you mean that this will be a Windows application.

So given that ...

1 - I'd still recommend a database for faster access times. Certainly MySQL, SQL Server all need installations, but there are plenty of other DB's that do not need to be installed: SQLite and (heaven forbid) Access come to mind. I have another client that swears by "Advantage Database", but I seem to prefer SQLite over Advantage. Alternatively, you could use an XML file, but as the data scales up in quantity and size, the DB option becomes more appealing, especially from a troubleshooting perspective (manually viewing a text file versus SQL statements). Either way, C# (actually Dot Net in general) is straight forward for ODBC connections.

2 - There are a variety of ways. You could dynamically instantiate a CheckBox control in a loop that goes through a DataSet. If the list of possible checkboxes is not dynamic nor directly changeable through the interfaces exposed to the user, you could just create the checkboxes in Design time.

3 - That depends on how you store the data. To keep things less memory-hogging, I'd just setup a custom call to the database to pull the data you need at the moment you need it, instead of letting it sit idle in memory.

4 - That depends on whether the checkboxes are dynamically displayed from client configurations. I know that sometimes you'll want some shown, sometimes none, and sometimes all shown. But if I knew that in each situation with 100% certainity, then I'd be more inclined to just query the database, iterate my true/false or on/off data, and check/uncheck each checkbox accordingly. I could even selectively hide/show checkbox fields as needed.

If each checkbox has a comment, then that adds another layer that must be considered in your data design. In my mind, that re-enforces the idea of using a DB instead of a flat file (CSV) or XML file.

HTH !!!
 
Thanks man that's really helpful.

I think XML files would be the best bet all around, I really want this to be a stand alone application, and when I say preset comments I mean maybe ball park range of... 500ish total, Couple questions, can XML be binded to a listbox or check list box and is it easy? I'm pretty good at researching stuff online, but I mean if you would highly recommend against it, than I'll take your word. Also to go back to the question about storing data until it need to compile it in a word dock, should I store that all in a new XML file? In my head this sounds pretty complex and overwhelming. I feel really nervous about the whole procedure. Perhaps playing around with it to get an idea of how it works will make me feel better, but ultimately my question is there any tools packaged with visual studio that will make the whole process easier as far as reading/writing XML files? Or any features that might assist a new programmer?
 
Thanks man that's really helpful.

I think XML files would be the best bet all around, I really want this to be a stand alone application, and when I say preset comments I mean maybe ball park range of... 500ish total, Couple questions, can XML be binded to a listbox or check list box and is it easy? I'm pretty good at researching stuff online, but I mean if you would highly recommend against it, than I'll take your word. Also to go back to the question about storing data until it need to compile it in a word dock, should I store that all in a new XML file? In my head this sounds pretty complex and overwhelming. I feel really nervous about the whole procedure. Perhaps playing around with it to get an idea of how it works will make me feel better, but ultimately my question is there any tools packaged with visual studio that will make the whole process easier as far as reading/writing XML files? Or any features that might assist a new programmer?

I don't know about packages or tools in VS.NET, but I've used the Xerces-C libs on many an occasion to store small bits of data and reports. If you're looking at creating a small app, you might want to look in that direction.

http://xml.apache.org/xerces-c/
 
[severe treatment]
You are far too inexperienced to be writing code and getting paid for it
[/severe treatment]

That said, I'd look at some other options. Something like infopath + sharepoint might be a better option for someone with little to no coding experience.
 
In 2.0 you can take a DataSet and turn it in to XML (or at least the individual DataTables). That's what I have found to be the best method for passing an entire DataSet in to a constructor--just feed it XML and let the XML do the rest. You can either turn it back in to a DataSet in the constructor or you can keep it as XML and load it in to an XmlDocument or XmlReader, if you are familiar with XML.

XML will be your friend when moving data through your program. Using a database would be nice for long-term storage, and in the past our company has used Firebird DB to save data locally while maintaining a small footprint. Think of it like a SQLLite-type thing... database access, saved to a flat file. Go search for it, you might like what you see!

202276
 
I'd still recommend using a database for any relative data storage versus a XML file or (even worse) a flat file.

One good example would be data reporting is much easier to implement and is more memory performant to query a DB with SQL to get a results DataSet, than compared to streaming an entire XML file to a DataSet of all of the data and then querying that whole file in memory for just the results you want.

The duration that the data is stored is irrelevant.
 
Good grief - Sql server express is FREE.

Provide it on the install disk with your app. You should provide the .NET run time as well to be sure the user has it.

The license for redistribution is free as well.
http://www.microsoft.com/sql/editions/express/redistregister.mspx

If your using VS 2005 then working with SQL express will be a breeze - the ide does like 90% of the work for you using data adaptors and what not.

To answer number 4 - design the database (domain tables for holding dropdown selections) with a couple tables to hold the "Real" data then fire up VS 2005 and go to town - since VS understands SQL server it will generate all the select, insert, update, delete commands for you if you want it to.
 
Back
Top