is there anyway by which i can check whether a command button has been clicked or not...

actually to check in my project whether a command button present in my dll has been clicked and based on that i have to do further processing......
is there any way out...

Hi Anud,

Just Keep a Public Form Level Boolean Variable, and Make that true When Comman button is Clicked. and check based on that

Regards
Veena

actually....how do i make the code written in my project wait until the command button in the module has been clicked......


i tried setting the boolean variable true when the command button is clicked.....but the statements in the main project are executed before the command button is clicked......how do i rectify this problem???

Hi,

In that case, u need to have a Global Boolean Varaiable, defined in .Bas with scope = Public

In ur module Give:

Public MyFlag As Boolean

In Command Click :
MyFlag =True

In the Procedure where u want to check give this in the Beginning:

If Not MyFlag Then Exit Sub.


REgards
Veena

thanks veena,

But the problem is still not sorted out.....can u please tell me how to make the programme wait until the commandbutton_click event has been fired.....

Hi Anud,

Can u please tell me what kind of program u r doing, (it makes easy for me to suggest).

u want to check in a single procedure or module..?

Regards
Veena

actually i have created a login authentication form a dll where there is this command botton....
and i am i am including this dll in my project....i want only if the user
presses the command button ...then only the further procesing should be done.....

is there any way to make the project wait untill this commandbutton_click event is fired???

Hi Anud,

Usually in such caeses, we Call First the Login Form, We dont write any code in "Sub Main", (which is the Default starting point). In Login Form Validate/Call Dll's/ Check number of Try's. If every thing is OK, the Call another procedure which will start the Connection To Main Program/Module/Populate Global Variables.

REgards
Veena

sorry veena but i am not been able to understand you....

Anu, You again!

See a dll works as a subprogram right?

in that you have a form with a command button and you want to know in your main program whether the user had clicked the command button in it. Ist it not.?

First tell me whether that form is visible with the command button and get back to me.

yes sir the form along with the command button is visible...

Hello Anud,

UR .dll Form Has Got COMMAND Button....?

Look, after compilation, u can only access .dll's Libraries/Procedures/Functions.
Visual Interface of Dll has got no meaning in the Calling Program.
Clearify...

Regards
Veena

ya i created the showform function in the dll's class.....after calling the showform function i want the execution to proceed only after the command button has been clicked....

Hi,

Then in .dll call the form in Modal:

Form1.Show 1

And in Command Click, Unload the Form


Regards
Veena

its still not working.....i think its a case of making a thread wait.....can you please give an example wherein i can make a particular thread untill a particular event is fired....

hello anud18.. i think veena is right. if ur just doing a login forn... try call it then proceed to the process u want after the clicked event..
sometimes we need to change everything to fixed our problems!!!

but if u really want to put a code as it is...
and u want a wait until button is pressed??? try put a loop before the process need to be executed after the clicked and put a DOEVENTS .. use the variable to end the loop.. i hope it helps

havnt been able to sort out the problem still...

yes sir the form along with the command button is visible...

OK in that in sub command1_Click() you add

Unload Form2

and back in the main form immediately after

Form2.Show vbModal

Give this command

Form_load
command1.SetFocus (or any control in the main form)

remember a second form_load will duplicate all those AddItems
beware of that one.
For that for each control you have to removeitems in a loop that has been added on the initial state.

not working sir

not working sir

OK Give me the piece of code which you used to call the second form( your dll) and from the dll code few lines where the command1_click.()

MyDll.ShowForm
this was the function i used to show my form ...
showform is defined in the dll as follws...

Public Function ShowForm() As Boolean


Form1.Show

End Function


and the command_click event is defined as given:

Public Sub Login_Click()
Unload Form1
Dim Ctr As Integer

Ctr1 = 0

For Ctr = 0 To (CboUserName.ListCount - 1) Step 1

If Text1.Text = CboUserName.List(Ctr) And Text2.Text = CboPassword.List(Ctr) Then
Ctr1 = 1
End If

Next

End Sub

Hi Anud,

Where is the Code which u dont want to execute until command click....?

Regards
Veena

KRN_StartForm
This is the function which i want to run on clicking the command button

and this function is defined in the project that is calling the dll

MyDll.ShowForm
this was the function i used to show my form ...
showform is defined in the dll as follws...

Public Function ShowForm() As Boolean


Form1.Show

End Function


and the command_click event is defined as given:

Public Sub Login_Click()
Unload Form1
Dim Ctr As Integer

Ctr1 = 0

For Ctr = 0 To (CboUserName.ListCount - 1) Step 1

If Text1.Text = CboUserName.List(Ctr) And Text2.Text = CboPassword.List(Ctr) Then
Ctr1 = 1
End If

Next

End Sub

1.See you will have a main program that calls your dll for login. Is it correct?
2. form1 is attached to your dll. is it correct? or your dll calls the form1 created by the main?
3. In which ever case after the user login where do you check it in lists.

I want answer for these. Better you fill here

my main program
form_load()

call to mydll............................>my dll Function()
codes

Iam back here <......................End function

Further my code in main.
If you do not want to expose your code to others, send me as a private message

regards
AV Manoharan

.

Hi,

In that case, Show ur Form in dll in Modal only..

Regards
Veena

Global MyDll As New dll.Class1

main()

first i call the initialize function to initialize the combo-boxes present in the form(created in the dll) with some values(in 1 combo-box its the usernames and the other combo-box contains the password)

then i call MyDll.ShowForm
this function in the dll is defined as :
ShowForm()
Form1.Show()
End sub

now after showing the form i want the user to be able to input the user name and value provided in the form....after this the user clicks the command button...if the username and password matches any of the combinations present in the combo-boxes.....then i want to run the function KRN_Startform() which is defined in the project.....

now what is happening is the compiler is not waiting for the user to input values and click the command button.....
how can i make the execution to terminate untill the user clicks the command button..

Global MyDll As New dll.Class1

main()

first i call the initialize function to initialize the combo-boxes present in the form(created in the dll) with some values(in 1 combo-box its the usernames and the other combo-box contains the password)

then i call MyDll.ShowForm
this function in the dll is defined as :
ShowForm()
Form1.Show()
End sub

now after showing the form i want the user to be able to input the user name and value provided in the form...

.after this the user clicks the command button...if the username and password matches any of the combinations present in the combo-boxes.....then i want to run the function KRN_Startform() which is defined in the project.....

now what is happening is the compiler is not waiting for the user to input values and click the command button.....
how can i make the execution to terminate untill the user clicks the command button..

Where do you do it?
in the dll or in the main?

in the dll

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.