hi there, I'm new here.
I have a problem to open a form with variable. Help me Please

Recommended Answers

All 14 Replies

Can you pass few more details on your exact requirment please.

Hi esdat...specify more what the problem and show the effort friend :).

ps : (welcome to daniweb)met datang di daniweb pak.

i think what he means is creating a function that would open a form through a varialble..

this is only my opinion about what he said...

Sample:

on the Click event of the button, i wanna close a form.. he prefers to call a function.

call CloseForm(variable)

sub Closeform(variable)
'the variable would trigger the open event of the form...
end sub

is that what you want? edsat?

Are you trying to do this

Private Sub Command1_Click()
Dim f As New Form1
f.Show
End Sub

hmmm. i got a same think like debasisdas

I made a menu with ListView. when i doubleclick selected item on that menu, it must call form that i put the formname on a variable that call nAction

Private Sub ListMenu_DblClick()
Dim nAction As String
nAction = ListMenu.SelectedItem.SubItems(1)
?......
load a formname nAction ?
End Select
thank's

Then you can directly call the form with its corresponding event. But i am not sure what do you mean by I made a menu with ListView.

Private Sub ListView1_DblClick()
Select Case ListView1.SelectedItem.Text
    Case "form1"
        form1.Show
    Case "form2"
        form2.Show
    ...
    Case Else
        MsgBox "ga ada yang diload"
End Select
End Sub

Makasih atas solusinya. Tapi mungkin ada ng command yang lebih singkat jika dalam menu tersebut ada puluhan item. Apa harus dibikin case sebanyak item tersebut. Bantuin dong jx_man. Trim's

Then you can directly call the form with its corresponding event. But i am not sure what do you mean by I made a menu with ListView.

he put the all form in list view and call the form when dbl click the item.


PS : ya, akan saya coba.
bpk, coba deskripsikan masalahnya,soalnya orang2 disini belum ngerti kalau bpk maunya pakai variable dan error dari program bpk belum tau juga. btw pakai bhs inggris aja pak,ntar ada yang komplain :) (cuma kita yg dr indonesia). kemarin saya coba pakai variable tapi malah error.

if i not understand, the problem is :
he want to use variable to call other form by click the item in listview. i tried to use variable but getting some error.so i used select-case but how if there are many form/item?does he call for each of item or form? any suggestion for him?

Please mention the error clearly.

BTW this is an English only forum so please use English only as your mode of communication.

Hello, what are you trying to say?? I think you can use the .show code for that one..
or also try the OpenFileDialog..

why he must use openFileDialog???
he want to show form with variable that it contain name of destination form. he used listview as menu to select form name to open.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.