|
-
Mar 25th, 2005, 11:58 PM
#1
Thread Starter
New Member
Problems creating a tabbed network app
Ok, I know I'm in WAY over my head here, but that's been the story of my life for 4 decades, so here goes:
I'm trying to create a server/client app for playing RIFTS® across a network that consists of a simple(HAH!) client character sheet that logs into a server, allowing the GM (server app) to view/modify data. I don't have the winsock part started yet, so we won't worry about that yet (Thank God!). My problem is that I want to find a way to perform a "quick load" of the more than 100 textboxes on the server side sheet without having to create 3 lines of code for each one. I have the textbox names stored in an array, so I can (hopefully) use that to iterate through all the names in a loop, but have no idea how to implement the load statement using an array reference. An example of the code I'm using is below, and I can more fully explain the concept I have in mind, if needed.
VB Code:
Private Sub btnAddTab_Click()
' Adds a new tab when a new client connects, adding new textboxes for
' each alterable attribute
Dim i, c As Integer, temp As String
TabStrip1.Tabs.Add
tCnt = TabStrip1.Tabs.Count
TabStrip1.Tabs(tCnt).Caption = "Tab #" & tCnt ' Testing purposes only, for now
' To be replaced by the Client's Character name at a later time
cnt = txtName.Count
TextBoxNameArray = Array("txtName", "txtAlign", "txtHP", "txtCHP", "txtSDC", "txtCSDC", _
"txtLvl", "txtEXP", "txtOCC", "txtIQ", "txtSkB", "txtME", "txtSVPI", "txtMA", _
"txtTrust", "txtPS", "txtDmgB", "txtPP", "txtStrPryDdg", "txtPE", "txtCmDthPs", _
"txtPB", "txtCharm", "txtSpd", "txtFPM", "txtPPE", "txtISP")
c = UBound(TextBoxNameArray)
For i = 0 To c
' The block below is where I'm having trouble
'------------------------------------------
temp = TextBoxNameArray(i)
Load frmServer.Controls(temp)(cnt)
TextBoxNameArray(i)(cnt).ZOrder 0
'------------------------------------------
Next
'Load txtName(cnt)
'txtName(cnt).Text = TabStrip1.Tabs(tCnt).Caption
'txtName(cnt).ZOrder 0
' Stop
End Sub
Now, obviously, the code I have in there is not only non functional, it throws errors. This is also a greatly reduced version of the array, since there are 184 textboxes to be used (unless I find a better way to implement this). I'm not even certain if there's a way to load controls in the manner I want (Fumbling NOOB here), but I'm hoping, since it will reduce the code size tremendously.
The commented out lines at the bottom of the example illustrate how each textbox is individually loaded, so you can see what I have to do, per textbox, to load each new tab with data. I'm sure there are better ways to do this, but I'm learning by trial and error here... Quite possible the WORST way to learn this... 
Ok, I've talked enough. Thanx for looking, and any suggestions are humbly and gratefully accepted.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|