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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi there, I am designi

Status
Not open for further replies.

manojEP

Programmer
Dec 17, 2003
9
0
0
IN
Hi there,

I am designing a form that dynamically generates and displays controls(text boxes and combos) for the fields that a user has selected in the fieldlist of a table.
After generation of these controls, the form is handed over to the user (this is similar to a wizard)... The user needs to save this form in the name what he wants, so that he can make use of it in his project, rearrange the controls order, give different names to the controls etc.

Now tell me, how to enable the user to save this form at his required location??? commanddialog1.showsave does not work.....

exp. reply...
advncd thnx...

with regards,
manojEP
 
All the common dialog box does is provide you with a file name. You have to dictate how you save it.

Let me get this straight.
1) You've created a form that via some controls lets you build the User interface portion of another form.
2) This wizard lets you select the control type for each control (ie text box, combo box, etc

At this point you are unsure how to save this built form?

Is this for a developer that will compile the form into their application or is this a dynamic builder that needs to store formating of this custom form and be able to render and use it without the main application being recompiled.
 
hi mr. SemperFiDownUnda,

thnx that you understood the situation....

this is basically for a developer, who will save the newly generated form in his application and compile it in his project....

kinldly give me the code for saving the form...

that is the code after CommonDialog1.ShowSave....

thnx....

with regards,
manojEP
 

manojEP,

The best way to figure this out is to start a dummy project and add several forms. Then start adding various controls to these forms and setting various properties (best if you add some control packs like the MS Win Common control packs to this project). Save the forms and then open notepad. Use notepad to open the *.frm files (they are just ascii files). You will see code something like ...
[tt]
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 525
Left = 1740
TabIndex = 0
Top = 1350
Width = 1245
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
[/tt]

(Yes even VB 6.0 SP5 still has the first line of VB 5.0.)

Now the more you look at these files and their format the better you will be able to write/print them out your self.

And as another thought of what you might be asking you will want to look up the following in help ...

FreeFile
Open
Line Input
Print
Write

Then another thought ...
[tt]
Private Sub Command1_Click()
On Error GoTo CDCancelError
Dim FName As String
CD.CancelError = True 'CD = Common Dialog, if use cancels then we will know
CD.ShowSave
If Trim(CD.FileName) = vbNullString Then Exit Sub'double check
FName = CD.FileName
If Dir(FName) <> vbNullString Then
If MsgBox(&quot;Replace File?&quot;, vbYesNo + vbQuestion, &quot;File Exists!&quot;) = vbNo Then Exit Sub
End If
'Write/print file here
Exit Sub
CDCancelError:
If Err.Number = 32755 Then MsgBox &quot;User Canceled Save&quot;
End Sub
[/tt]

Good Luck

 
HI vb5prgrmr ,

thnx for your suggestion....
let me try it out and tell you....

Wish you a very happy and prosperous new year...

with regards,
manojEP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top