473,796 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unloading form problem.

devonknows
137 New Member
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.
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Public g_fmrSearch As fmrSearch
  3. Public g_frmsettings As frmsettings
  4.  
  5. Public Sub Main()
  6. Set g_fmrSearch = New fmrSearch
  7. Set g_frmsettings = New frmsettings
  8. 'which ever form you want to startup put that form name followed show property
  9. g_fmrSearch.Show
  10. End Sub
  11.  
fmrSearchcode
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. 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
  4. Private Const SW_SHOW = 5
  5. Private rs As ADODB.Recordset
  6. Private Sub Check1_Click()
  7. If Check1.Value = 0 Then
  8. g_fmrSearch.Top = g_fmrSearch.Top - 1255
  9. g_fmrSearch.Height = 2805
  10. updatesearchall = 0
  11. List1.Visible = True
  12. Else
  13. If Check1.Value = 1 Then
  14. g_fmrSearch.Height = 1550
  15. List1.Visible = False
  16. g_fmrSearch.Top = fmrSearch.Top + 1255
  17. updatesearchall = 1
  18. End If
  19. End If
  20. End Sub
  21. Private Function searchallfunction()
  22.         Call getdbinfo
  23.         Call connection
  24.         Set getsd = conn.Execute(getsearchdata, , adCmdText)
  25.         Set getpd = conn.Execute(getprogramdata, , adCmdText)
  26.         Dim replacementtext
  27.         Dim maxsites As Integer, sitesopened As Integer, maxsitereached As Integer
  28.         Dim endcommand
  29.         sitesopened = 1
  30.         maxsitereached = 0
  31.         maxsites = getpd!sitesopensafetymarker
  32.         Do While Not getsd.EOF
  33.             If sitesopened <= maxsites Then
  34.                 replacementtext = Replace(Text1.Text, " ", getsd!keywordsplitmarker)
  35.                 endcommand = getsd!endcommandstring
  36.                 ShellExecute hwnd, "open", getsd!websitesearchaddress & replacementtext & endcommand, vbNullString, vbNullString, SW_SHOW
  37.                 getsd.MoveNext
  38.                 sitesopened = sitesopened + 1
  39.                 lastsearch = Text1.Text
  40.             Else
  41.                 If maxsitereached = 1 Then
  42.                     getsd.MoveNext
  43.                 Else
  44.                     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!"
  45.                     maxsitereached = 1
  46.                     getsd.MoveNext
  47.                 End If
  48.             End If
  49.         Loop
  50. End Function
  51. Private Sub btnsearch_Click()
  52.     If Text1.Text <> "" Then
  53.         If Check1.Value = 1 Then
  54.             If lastsearch = Text1.Text Then
  55.                   answer = MsgBox("" & Text1.Text & " matches the previous search, are you sure" & vbCrLf & "you want to continue?", vbYesNo, "Are you sure?")
  56.                   If answer = 7 Then
  57.                         MsgBox "Search Halted", vbInformation, "Search Halted"
  58.                   Else
  59.                          Call searchallfunction
  60.                   End If
  61.             Else
  62.                Call searchallfunction
  63.             End If
  64.         Else
  65.             MsgBox "Unticked"
  66.         End If
  67.     Else
  68.         MsgBox "You need to input query into the search field.", vbCritical, "An Error has Formed"
  69.     End If
  70. End Sub
  71.  
  72. Private Sub Form_KeyPress(keyascii As Integer)
  73. If keyascii = vbKeyReturn Then
  74. btnsearch_Click
  75. End If
  76.  
  77. End Sub
  78. Private Sub Form_Terminate()
  79. If updatesearchall = 1 Then
  80.     Call getdbinfo
  81.     Call connection
  82.     Set rs = New ADODB.Recordset
  83.     rs.Open Source:="programdata", _
  84.         ActiveConnection:=conn, _
  85.         CursorType:=adOpenDynamic, _
  86.         LockType:=adLockOptimistic
  87.     rs!searchall = updatesearchall
  88.     rs.Update
  89.     Unload Me
  90. End If
  91. If updatesearchall = 0 Then
  92.     Call getdbinfo
  93.     Call connection
  94.     Set rs = New ADODB.Recordset
  95.     rs.Open Source:="programdata", _
  96.         ActiveConnection:=conn, _
  97.         CursorType:=adOpenDynamic, _
  98.         LockType:=adLockOptimistic
  99.     rs!searchall = updatesearchall
  100.     rs.Update
  101. Unload Me
  102.  
  103.     End If
  104.     Unload Me
  105. End Sub
  106.  
  107. Private Sub mnuPref_Click()
  108. settingsopen = 1
  109. Unload Me
  110. g_frmsettings.Show
  111. End Sub
  112.  
  113. Private Sub mnuQuit_Click()
  114. Unload Me
  115. End Sub
  116. Private Sub Form_Load()
  117. updatesearchall = 2
  118. answer = 6
  119. Call getdbinfo
  120. Call connection
  121. Set getpd = conn.Execute(getprogramdata, , adCmdText)
  122. If getpd!searchall = True Then
  123. Check1.Value = 1
  124. Check1.Caption = "Search all torrent sites? (" & getpd!numsites & ")"
  125. g_fmrSearch.Left = 8300
  126. g_fmrSearch.Top = 9555
  127. List1.Visible = False
  128. g_fmrSearch.Height = 1550
  129. Else
  130. Check1.Value = 0
  131. Check1.Caption = "Search all torrent sites? (" & getpd!numsites & ")"
  132. List1.Visible = True
  133. g_fmrSearch.Top = 8300
  134. g_fmrSearch.Left = 8300
  135. g_fmrSearch.Height = 2805
  136. End If
  137.  
  138. End Sub
  139.  
Dec 5 '06 #1
1 1670
devonknows
137 New Member
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
Dec 5 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1634
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,...
9
4429
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?
2
1606
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...
3
3655
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...
2
8591
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.
2
4217
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...
0
1306
vdraceil
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...
3
1134
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:
6
2052
vdraceil
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...
0
9685
marktang
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...
0
9533
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,...
0
10461
Oralloy
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...
1
10190
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,...
0
9057
agi2029
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...
1
7555
isladogs
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...
0
6796
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();...
1
4122
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
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.