Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing an MDI from a Child - Where do i put the Dataset???

Status
Not open for further replies.

mojoT

Technical User
Sep 23, 2003
25
NZ
I have a rich text box field in my MDI to display help messages, that - thanks to FAQ796-3279 - I can fill from one of my Child Forms.

What i need to do now is fill the text box from the child form with information stored in a SQL Server database. Where do I put the data adapter and dataset? On the MDI or the Child Form?

At first I thought the Child Form, because that's where I'll be using the select statement to get the information... but then I realised I need to bind the text box on the MDI.

Can this be done???????
 
So it knows what information to display???

If you have a better idea of how to do the whole thing, PLEASE tell me. Here's what i need to do:

The rich text box is to display help for every text box on all the child forms. What I need to do is:

1. Create a table in my database with 2 columns: HelpID and Reference, where the reference links to the actual helpfile. (I still haven't figured that bit out yet)

2. Make a SQL statement that selects the right helpfile for each text box.

3. Show that help file in the rich text box on the MDI form.

The whole thing confuses me a little bit. I'm not really good at programming. So if you can suggest anything to help, or a better way of doing it, or tell me where I'm going wrong, I'd really appreciate it.


 
Mojo,

The richtextbox is an optionally bound control, there are a few ways to set what it displays. Assuming you've dimmed it as rtf, you could do an rtf.appendtext. An rtf.clear does what it says.
Gives you more control, just as an example:
rtf.clear
fnt = New Font("Arial", 12, FontStyle.Bold)
rtf.SelectionFont = fnt
rtf.AppendText(Titletext)
fnt = New Font("Arial", 10, FontStyle.Regular)
rtf.SelectionFont = fnt
rtf.AppendText(bodytext)

It's a great control you can get a lot of usage out of, but it isn't quite straightforward. I think Microsoft has a whole section about it on their website someplace.



 
So, just for instance, instead of having to store everything in text files, could i make my table as follows:

ID
Title
HelpText

Then just use the rtf.AppendText(Title) and bold it or whatever, then go rtf.AppendText(HelpText)

So that it looks nice?

And then i don't need to worry about having to make separate files etc????

Thanks so much for your help. I'm really grateful.
 
Mojo,

Yep. Keep in mind the font on .appendtext is set in advance of placing the text and that you may need to add controlchars.crlf to the text for spacing.
.selectionfont is a font type so you can pick the individual elements as well (.bold,.name,.italic,.size etc.)
If you have a large amount to load, you could also create an rtf file in Word and then do a rtf.LoadFile(filename).

phan
 
Thank you! Thank you! Thank you! Thank you! Thank you! Thank you!

[bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top