[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Displaying Form.....

I have one text box......

then a user enters a form name in this textbox.....Now how do i display this  form object.....

tapsbin
0
tapsbin
Asked:
tapsbin
1 Solution
 
wileecoyCommented:
Can you give a little more information?

Are you giving the user a list of possible forms to enter?

If so, you should probably use a Select Case statement.

For example:


Select Case textbox.text
     case "Main"
          frmMain.Show
     case "About"
          frmAbout.Show
     ......etc
     case else
          msgbox "Please Enter A Valid Form"
end Select

That is a simple example in which the user is presented with a list of forms to select.

Please respond and let me know if I understood your question.  If not please explain where I missed the mark.

Thanks!
0
 
Sankar030999Commented:
willecoy is correct. as far as i know, thats the way to do it.
but instead of using a text box, y dont u use a combo box and populate them with the form names. by this way, the user can select the form to be displayed by clicking on the combo box.
check it out...
0
 
Éric MoreauSenior .Net ConsultantCommented:
You should list your form in a listbox to help user!!!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
KDivadCommented:
If you "pre-load" all your forms, then this is a good way to do it:

For Each Form In Forms
    If Form.Name = Text1.Text Then
        FormFound = True
        Form.Show
        Exit For
    End If
Next
If Not FormFound Then MsgBox "No such form!"

Problem is: the Forms collection only contains loaded forms.
0
 
amebaCommented:
Private Sub Text1_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = vbKeyReturn Then Forms.Add(Text1.Text).Show ' requires VB6 SP3
End Sub
0
 
amebaCommented:
Option Explicit

Private Sub Form_Load()
    Text1.Text = "Form1"
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    Dim frm As Form
    On Error GoTo EH
   
    If KeyAscii = vbKeyReturn Then
        Set frm = Forms.Add(Text1.Text)
        frm.Move Me.Left + 300, Me.Top + 300
        frm.Show
        KeyAscii = 0 ' prevent beep
    End If
    Exit Sub
EH:
    MsgBox Err.Description
End Sub
0
 
tapsbinAuthor Commented:
Will test and respond to you quickly.....
0
 
tapsbinAuthor Commented:
i have field with different form name. While looping through the field values, it should also invoke an instance of that form object, as well as should keep track of that instance, as and when needs to be fetched.

thanks
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now