Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 19th, 2007, 10:03 AM   #1
randum77
Programmer
 
randum77's Avatar
 
Join Date: Jun 2006
Location: Fayettehell, NC
Posts: 56
Rep Power: 3 randum77 is on a distinguished road
Dynamic form from text file.

Ok, new one here. I've been trying to build a form from a text file. What I am trying to do specifically is when a form loads, it attaches to a txt file, reads it line by line, and build a radio button form based on it. This way, if we want to change the look of the form we can just update the txt file, rather then have to re compile the entire app.

What I've done so far is create the ioStreamReader and attached to the file. I was able to list the entire contents to a text box just to make sure the iostream was reading how I wanted it too. Now, i want it to read each line of the document, read to the first ", " and use that text as the app name, and everything after the comma as the path. For each line, i need a bullet w/ app name.

I was going to use a substring but i don't think it would do what I want, it would show the ", " and it's not dynamic enough. Also, i'm having a hard time brainstorming on the method to get the Radio button and lable to be generated at the procedure level. I've never done it before and am kind of lost. I know i'll also need to do an X and Y coordinate and increment it as well.

Well, any help is appreciated. I'll do some searches google and see what it shows.
__________________
_Marshall_

"America has bred a society that is innocent and incapable of accepting responsibility, but yet, is able to place blame on others without guilt."
randum77 is offline   Reply With Quote
Old Apr 19th, 2007, 10:25 AM   #2
randum77
Programmer
 
randum77's Avatar
 
Join Date: Jun 2006
Location: Fayettehell, NC
Posts: 56
Rep Power: 3 randum77 is on a distinguished road
I found this link with some information. Does it sound about right?

http://www.developerfusion.co.uk/forums/post/150908/
__________________
_Marshall_

"America has bred a society that is innocent and incapable of accepting responsibility, but yet, is able to place blame on others without guilt."
randum77 is offline   Reply With Quote
Old Apr 19th, 2007, 11:14 AM   #3
randum77
Programmer
 
randum77's Avatar
 
Join Date: Jun 2006
Location: Fayettehell, NC
Posts: 56
Rep Power: 3 randum77 is on a distinguished road
I found that the following code will make a radio button.

Dim rbYes As New RadioButton()
            rbYes = New RadioButton()
            rbYes.Left = 8
            rbYes.Top = 300
            Me.Controls.Add(rbYes)
            rbYes.Text = "YES"

The button will say YES next to it. Now, I have to figure out how to make it completely dynamic. I'm assuming I would use variable in all location possible, and on the Top and Left properties, i would increment them as needed. The only part that I wouldn't know right off is how to make the property name dynamic. The rbYes is what I mean. Would i declare it as rbYes(i) or something like that? I appreciate the help.
__________________
_Marshall_

"America has bred a society that is innocent and incapable of accepting responsibility, but yet, is able to place blame on others without guilt."
randum77 is offline   Reply With Quote
Old Apr 23rd, 2007, 8:59 AM   #4
melbolt
Hobbyist Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 244
Rep Power: 4 melbolt is on a distinguished road
Send a message via AIM to melbolt Send a message via Yahoo to melbolt
Quote:
Originally Posted by randum77 View Post
The only part that I wouldn't know right off is how to make the property name dynamic. The rbYes is what I mean. Would i declare it as rbYes(i) or something like that? I appreciate the help.
well, you could give them names IF you knew how many you were going to have, then you could hardcode them in, but since you could have anywhere form 1 to 100, this is inconvenient, redundant, and not very efficient coding to do it this way.


instead, what you probably want to do is this, just keep adding them like so

vbnet Syntax (Toggle Plain Text)
  1. rbYes = New RadioButton()
  2. rbYes.Left = 8
  3. rbYes.Top = 300
  4. Me.Controls.Add(rbYes)
  5. rbYes.Text = "YES"

now when you want to access it you can do something like this or some variation of it.

vbnet Syntax (Toggle Plain Text)
  1. 'iterate through every radiobutton control on the form
  2. For Each rb As RadioButton In Me.Controls
  3. If (rb.Checked) Then
  4. MsgBox(rb.Text & " was checked!!!")
  5. End If
  6. Next

you can also get to a control through its index (ex: me.controls(2))
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote
Old Apr 24th, 2007, 11:39 AM   #5
randum77
Programmer
 
randum77's Avatar
 
Join Date: Jun 2006
Location: Fayettehell, NC
Posts: 56
Rep Power: 3 randum77 is on a distinguished road
Melbolt, thank you for the reply. I've been constructing a loop in my free time, but i've been put on another project for a couple days so it might be a bit before I can respond. I'll be back, but for now, I've got to ask other questions. Dag nabit.
__________________
_Marshall_

"America has bred a society that is innocent and incapable of accepting responsibility, but yet, is able to place blame on others without guilt."
randum77 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
converting string to float beginnerCCC C 22 Oct 2nd, 2006 11:59 PM
OnlineTextEditor.Com! Sane Show Off Your Open Source Projects 43 Jun 16th, 2006 8:55 AM
How to detect cursor location and insert text??? syntax-error C# 3 Jun 30th, 2005 1:42 AM
After execution - Error cannot locate /Skin File? wchar Visual Basic 1 Mar 5th, 2005 9:04 PM
airport Log program using 3D linked List : problem reading from file gemini_shooter C++ 0 Mar 2nd, 2005 4:12 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:45 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC