Ok, i posted about forcing a form to unload, now since ive implemented that, when check1.value = true, when you close the form, it doesnt unload,
when check1.value = false, it unloads perfectly and does all the ADO with it, but when check1.value = true its doing the ADO commands, but just not unloading, if anyone can shed some light would be most greatful.
Kind Regards
Devon.
Module code. -
Option Explicit
-
Public g_fmrSearch As fmrSearch
-
Public g_frmsettings As frmsettings
-
-
Public Sub Main()
-
Set g_fmrSearch = New fmrSearch
-
Set g_frmsettings = New frmsettings
-
'which ever form you want to startup put that form name followed show property
-
g_fmrSearch.Show
-
End Sub
-
fmrSearchcode -
Option Explicit
-
-
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
-
Private Const SW_SHOW = 5
-
Private rs As ADODB.Recordset
-
Private Sub Check1_Click()
-
If Check1.Value = 0 Then
-
g_fmrSearch.Top = g_fmrSearch.Top - 1255
-
g_fmrSearch.Height = 2805
-
updatesearchall = 0
-
List1.Visible = True
-
Else
-
If Check1.Value = 1 Then
-
g_fmrSearch.Height = 1550
-
List1.Visible = False
-
g_fmrSearch.Top = fmrSearch.Top + 1255
-
updatesearchall = 1
-
End If
-
End If
-
End Sub
-
Private Function searchallfunction()
-
Call getdbinfo
-
Call connection
-
Set getsd = conn.Execute(getsearchdata, , adCmdText)
-
Set getpd = conn.Execute(getprogramdata, , adCmdText)
-
Dim replacementtext
-
Dim maxsites As Integer, sitesopened As Integer, maxsitereached As Integer
-
Dim endcommand
-
sitesopened = 1
-
maxsitereached = 0
-
maxsites = getpd!sitesopensafetymarker
-
Do While Not getsd.EOF
-
If sitesopened <= maxsites Then
-
replacementtext = Replace(Text1.Text, " ", getsd!keywordsplitmarker)
-
endcommand = getsd!endcommandstring
-
ShellExecute hwnd, "open", getsd!websitesearchaddress & replacementtext & endcommand, vbNullString, vbNullString, SW_SHOW
-
getsd.MoveNext
-
sitesopened = sitesopened + 1
-
lastsearch = Text1.Text
-
Else
-
If maxsitereached = 1 Then
-
getsd.MoveNext
-
Else
-
MsgBox "Your Current Settings do not allow for you to go above " & maxsites & " sites," & vbCrLf & "You can change this in the settings menu.", vbInformation, "Information!"
-
maxsitereached = 1
-
getsd.MoveNext
-
End If
-
End If
-
Loop
-
End Function
-
Private Sub btnsearch_Click()
-
If Text1.Text <> "" Then
-
If Check1.Value = 1 Then
-
If lastsearch = Text1.Text Then
-
answer = MsgBox("" & Text1.Text & " matches the previous search, are you sure" & vbCrLf & "you want to continue?", vbYesNo, "Are you sure?")
-
If answer = 7 Then
-
MsgBox "Search Halted", vbInformation, "Search Halted"
-
Else
-
Call searchallfunction
-
End If
-
Else
-
Call searchallfunction
-
End If
-
Else
-
MsgBox "Unticked"
-
End If
-
Else
-
MsgBox "You need to input query into the search field.", vbCritical, "An Error has Formed"
-
End If
-
End Sub
-
-
Private Sub Form_KeyPress(keyascii As Integer)
-
If keyascii = vbKeyReturn Then
-
btnsearch_Click
-
End If
-
-
End Sub
-
Private Sub Form_Terminate()
-
If updatesearchall = 1 Then
-
Call getdbinfo
-
Call connection
-
Set rs = New ADODB.Recordset
-
rs.Open Source:="programdata", _
-
ActiveConnection:=conn, _
-
CursorType:=adOpenDynamic, _
-
LockType:=adLockOptimistic
-
rs!searchall = updatesearchall
-
rs.Update
-
Unload Me
-
End If
-
If updatesearchall = 0 Then
-
Call getdbinfo
-
Call connection
-
Set rs = New ADODB.Recordset
-
rs.Open Source:="programdata", _
-
ActiveConnection:=conn, _
-
CursorType:=adOpenDynamic, _
-
LockType:=adLockOptimistic
-
rs!searchall = updatesearchall
-
rs.Update
-
Unload Me
-
-
End If
-
Unload Me
-
End Sub
-
-
Private Sub mnuPref_Click()
-
settingsopen = 1
-
Unload Me
-
g_frmsettings.Show
-
End Sub
-
-
Private Sub mnuQuit_Click()
-
Unload Me
-
End Sub
-
Private Sub Form_Load()
-
updatesearchall = 2
-
answer = 6
-
Call getdbinfo
-
Call connection
-
Set getpd = conn.Execute(getprogramdata, , adCmdText)
-
If getpd!searchall = True Then
-
Check1.Value = 1
-
Check1.Caption = "Search all torrent sites? (" & getpd!numsites & ")"
-
g_fmrSearch.Left = 8300
-
g_fmrSearch.Top = 9555
-
List1.Visible = False
-
g_fmrSearch.Height = 1550
-
Else
-
Check1.Value = 0
-
Check1.Caption = "Search all torrent sites? (" & getpd!numsites & ")"
-
List1.Visible = True
-
g_fmrSearch.Top = 8300
-
g_fmrSearch.Left = 8300
-
g_fmrSearch.Height = 2805
-
End If
-
-
End Sub
-
1 1670
Slight update on the post above.
if the form starts in with Check1.Value = 1
if the form is in Check.Value = 0 the form always unload no matter what
but
after the check1 has been clicked then if the Check1.value = 1 it doesnt unload it just closes, hope that helps you
Kind Regards
Devon
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: LilleSkutt |
last post by:
I want to use assemblies (Window Forms as .dll) so that I can replace the form while the main application is running. To accomplish this, I used Assembly.LoadForm to manually load the assembly when I need it from a .DLL file. I then use CreateInstance to create the instance of the class, and then use the instance like I would use is with a normal design-time included assembly.
But the problem is, no matter how I try with closing the form,...
|
by: Rom Marshall |
last post by:
Hi.
Once a LOB size goes beyond 32KB in size, I'm not able to use the LOAD
utility to unload the data off the tables for DB2 7.1 on OS/390.
Instead, the documentation refers to a sample C++ program --
DSN710.SDSNSAMP(DSN8DLPL) to use for this purpose.
I'm wondering if anyone out there has a COBOL equivalent to this as I do
not have a C++ compiler?
|
by: Guru Prasad |
last post by:
Is there a delay involved in unloading assemblies once a virtual directory
is "deleted" using IIS Manager ? At times even after the virtual directory
is removed i cannot delete the backing physical directory and it looks like
ASPNET runtime is holding on to the assemblies. Once i recycle the ASPNET
process, i can delete this directory. Has this got anything to do with
strong-named/signed assemblies ( even though deployed as private...
|
by: Eric A. Johnson |
last post by:
In a new project I'm creating, I have my first form that loads being used as
a splash screen, with a timer that activates after 5 seconds. I then want
the main form to load. However, it isn't allowing me to use frmMain.Load().
What can I use to load the main form, then unload the splash screen? Or
should I, perhaps, load an invisible control form that first loads the
splash screen, waits five seconds, then unloads it and loads the main...
|
by: Geoff |
last post by:
VB6. When selecting from drop down menu options I display different forms by
using the Load (filename) and leave the form with Unload(Filename)
The Load event allows me to program the opening of a particular direct
access file and the Unload event lets me program the closing of the file.
Things are kept 'tidy' this way.
| |
by: RajaKannan |
last post by:
Hi All,
I have a form in which i have few mandatory fields. Wheneve the user tries to save, i check for these fields and alert them, if thet are empty. I have a CLOSE button in my form and whenever the user clicks the CLOSE button, i ask the user whether he wants to save before closing the form.
On the Form_Unload event, i check whether there are any new changes and if yes, i pompt the user for a save. But if they have not filled any of...
|
by: vdraceil |
last post by:
Hi,i use VB6.0..is it possible to prevent a form from unloading ever?
I know to set cancel=true in query unload event of the form..but this applies only to limited cases.
If my exe is closed from the task manager-"Applications" tab,i can detect it and prevent it from unloading,but if it is closed from the task manager-"Processes" tab,the form will be closed even without passing through the terminate,queryunload and unload events...
I'm...
|
by: Anthony P. |
last post by:
Hello Everyone,
I'm writing an application that, so far, only has three forms:
frmSplashScreen
frmLicenseScreen
frmConfigurationScreen
Now, frmSplashScreen has a timer that sits it on screen for 2 seconds
then executes the following commands:
|
by: vdraceil |
last post by:
I use vb6.i have a small problem guys..my form is not unloading.
I want my application to end only if the user presses shift+F10.so i run a timer with interval=1 which checks the keyboard state of both the keys.if at any instant both the keys are pressed a messagebox must be displayed and then the form must unload.
I've done the coding and what happens is the message box is displayed but the form doesnt unload.
I've tried debugging...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |