Reading strings from a database to edit

jvamp

Member
Joined
Feb 20, 2007
Messages
6
Programming Experience
Beginner
Hello all, I am trying to figure out how to load a set of strings from a database into a form to edit them and return them to the database.

I would like the user to see what appers to be a word processing or text editor type document on the screen. Back in my Pascal days I used a line-oriented text editor that I wrote for this, but cannot see how to do this using windows forms.

Would appreciate any hints.
jvamp:confused:
 
it depends on how you want to go about it...

do you want to store a 'document' as a whole, or a 'document', but line by line?

what is the reason for doing this in this way?

have a good one :)
adam
 
Reading strings from a database

I want to do it line-by-line.

The reason for all this is building templates for data entry. The strings stored in the database represent sections of the template. A pick-list will be used to allow users to select allowed words that can be added. Once the user has completed all editing the strings + user edits are saved back to the database as a "document".

It is very important that every word in the template be searchable within the database after saving. Also, each word in the template is linkedto all permissible words that may be it associated with.


For example, if the database string was

" I like milk."

Placing the cursor over the word "milk" would bring up a pick list of "chocholate", Strawberry", "Skim", etc. The user could then select from this list and the final string:

" I like chocholate, skim milk."

would then be saved back to the database. Hope this makes sense.


As I mentioned before, in my Pascal days I created a line oriented text editor and loaded the strings in an array to display them on a screen and allow for editing.

VB 2005 has so many controls and options did not want to re-invent the wheel for no reason.

Could one do this using an array in a textbox?

jvamp
 
Reading strings from a database for editing

Thanks for the link. However, I know how to move data from a database to a control (I have done this using a datagrid). The issue here is how to make the strings appear the be part of a word processing document and how to capture the user edits and return them to the database as a new "document".
jvamp
 
now, youve lost me. try putting more words in your post? :)

ps; if you want text and controls intermixed.. that sounds like a webpage (hint) :D
 
REading strings from a database for editing

I am trying to create an application that allows users to create data entry templates. Each template consists of sections and each section contains specific questions. The questions are loaded in from a database.

Once the template has been loaded users may answer the questions and save the template + edits back to the database as a new user document.

Now so far, what I am describing could be done in MS Word. The difference is that each template has a set of permitted words that may be used to answer any question. Those words are included in a separate database. The word list is also under the control of the user who may expand the list of words as needed.

I am trying to load the templates into a form and then allow a user to click on a question or words and see all of the permitted words that may be used at that point.

I cannot figure out the type of control to use to do this. A datagrid would work , but I want the document to appear like a MS word document, not a datagrid.

I have considered placing 30, 100 character text boxes on the screen and creating an array of 30 strings then loading the string into the array and creating buttons to simulate screen scrolling.

Do this make more sense?
JVamp
 
ok, im a tad confused as to why you are doing this, but a method (from how i understand it) could be this...

simply make a giant text box (a 'document'), and when the user clicks save, split the textbox into an array,

use this ...

VB.NET:
dim s() as string
 
s = txtYourDocument.Lines

simple as that :) and then from there you can do what you want to the database using the array.

hope it helps mate

regards
adam
 
Reading strings from a database

The goal is to allow creation of templates that can be created and stored by users. The idea ia to allow the templates to be as flexible as possible in trems of content that they contain while provide a way to constrain the words that are added when the document is saved after using editing.

Consider of a legal document in which for buying a house for exmaple. The document would have sections and certain boilerplate content. Changes to the content should be constrained to only those terms that would make sense in that particular setting and usage.
If I buy this system someone could be a database of legal templates that were "smart" in that they woudl allow you to change the wording of the document BUT only in ways that were appropriate.

Since the Document is all text, some means has to exist to provide structure and to assure that only permsissible word are added during editing. I'm trying to figure out how to provide an on-screen structure that will look like a word processing document and act like a data entry form.

JVamp
 
yeah.. it's called a webpage! :D

30 x 100 char textboxes, then 30 strings, then scrolling them? aieee... that's so much harder than the following html:

VB.NET:
<p>I like <select><option value = "milk">Milk</option><option value = "chocolate">Chocolate</option></select> for breakfast

Leave the hassle of rendering the text, to the web browser control.. When the user is done selecting things you can whoosh through the document DOM and get all the things they selected
 
Reading strings from a database for edting

A using a web page assumes that all of the allowable words can be displayed on the page. I will be dealing with legal and medical applications. On the medical side alone, using a simple controlled terminology, there are a minimum of 30,000 acceptable terms that may be used within a template or document. That why we need a database to keep things organized and why the document is structured.

These are much more like word processing documents in which every word must be selected from a predefined list AND each word selected MUST be properly used. This means that when a user tries to edit the document ONLY the words that make sense in that context can be provided in a pick list.

jvamp.
 
Maybe you missed the point that I was tryiong to get across:

Build a webpage HTML using FRAGMENTS stored in a database, then get a web browser to display it

There is actually a common name for this and it is very widely used. It's called ASP.NET
You arent writing an ASP app but you COULD do. Or you can make something LIKE an ASP app and show it in a WebBrowser control on your form,...


The crux thing I'm trying to get you to realise is that, rather than messing around building a form, you should mess around concatenating a huge string of text, with HTML tags, and then just tell a browser to display it.


ASP is normal web pages, with bits of code in that do stuff like go off to the database and put dynamic stuff in the output. This, for example:

VB.NET:
[I]For breakfast I like <select>%>[/I] 
foreach item in database.GetBreakfastChoices
  Response.Write("<option>" + item + "</option>")
next item
[I]<% but I dont like skimmed milk[/I]
[I]
[/I]

Hopefully this helps you see what Im driving at
 
Back
Top