[Question] Lock form with checkbox menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Spot_1337's Avatar Active Member
    Reputation
    16
    Join Date
    Feb 2007
    Posts
    90
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Question] Lock form with checkbox

    Hello,
    how do i lock my form in place when i press a checkbox and unlock it by unchecking it ?
    sorry for noob question

    [Question] Lock form with checkbox
  2. #2
    ReidE96's Avatar Archer Authenticator enabled
    Reputation
    470
    Join Date
    Dec 2006
    Posts
    1,625
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sub handling checkbox value changed
    If form is locked then unlock form
    If form is not locked then lock form
    End Sub

    There's an algorithm for it. Just turn it into vb code (for handling, do something like this: Private Sub Whatever() Handles Checkbox1.Changed (I don't remember the exact event name)) and you're sorted.

  3. #3
    Spot_1337's Avatar Active Member
    Reputation
    16
    Join Date
    Feb 2007
    Posts
    90
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    made it look like this
    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
    If CheckBox1.CheckState = CheckState.Checked Then Lock(Form1)
    but now i get the error value of type form1 can not be converted to integer

  4. #4
    EmiloZ's Avatar Flying Piggy Back
    CoreCoins Purchaser
    Reputation
    538
    Join Date
    Jun 2007
    Posts
    1,393
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It needs to be :
    Code:
    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
    If CheckBox1.CheckState = CheckState.Checked Then Lock(ME)
    Why fill up a signature?

  5. #5
    Spot_1337's Avatar Active Member
    Reputation
    16
    Join Date
    Feb 2007
    Posts
    90
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i still get same error

  6. #6
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lol.

    The Lock keyword is for thread synchronization. (Locks the current sub from being accessed until it hits the end of the lock statement, so threads don't try to use the same sub at the same time, ending up in bad bugs)

    You'd need to do some window border changing I think. (Not sure why you'd want to lock the form in place at all...) Just google for a way to do it.

  7. #7
    Spot_1337's Avatar Active Member
    Reputation
    16
    Join Date
    Feb 2007
    Posts
    90
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i wanna lock it so i don't accidentally move it , and i googled but the guides i found was a bit to complicated for a noob like me

  8. #8
    ReidE96's Avatar Archer Authenticator enabled
    Reputation
    470
    Join Date
    Dec 2006
    Posts
    1,625
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
          If CheckBox1.Checked Then Me.Locked = True
    End Sub


    Locks the form in place so it can't be resized or moved if you check the checkbox. Coded in VB.NET 2008.
    Last edited by ReidE96; 10-07-2008 at 10:54 AM. Reason: Borked me code tags

  9. #9
    Spot_1337's Avatar Active Member
    Reputation
    16
    Join Date
    Feb 2007
    Posts
    90
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *sigh* error again
    Locked is not a member of form1

  10. #10
    ReidE96's Avatar Archer Authenticator enabled
    Reputation
    470
    Join Date
    Dec 2006
    Posts
    1,625
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    o.0 Ok, plan b.
    Code:
    Private Sub Form_Resize() Handles Me.ResizeEnd
          If Checkbox1.Checked then
                Me.Size.Width = widthgoeshere
                Me.Size.Height = heightgoeshere
          End If
    End Sub
    Replace the width and height with the width and height you want it to stay as.

  11. #11
    Spot_1337's Avatar Active Member
    Reputation
    16
    Join Date
    Feb 2007
    Posts
    90
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no i don't want to lock the size feature just so u can't Move it

  12. #12
    ReidE96's Avatar Archer Authenticator enabled
    Reputation
    470
    Join Date
    Dec 2006
    Posts
    1,625
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Globals
    Code:
    Dim FormX, FormY as integer
    Checkbox Changed
    Code:
    Private Sub Checkbox_Changed() Handles Checkbox1.CheckedChanged
          If Checkbox1.Checked Then
                FormX = Me.Location.X
                FormY = Me.Location.Y
          End If
    End Sub
    Form Moved
    Code:
    Private Sub Form_Moved() Handles Me.LocationChanged
          If Checkbox1.Checked Then
                Me.Location.X = FormX
                Me.Location.Y = FormY
          End If
    End Sub
    Replace Checkbox1 with your checkbox's name.

    Edit:
    I could have just made it as before where it was locked in one place, but I'm guessing you might want to lock it in various locations, so I made it capable of that.

  13. #13
    Spot_1337's Avatar Active Member
    Reputation
    16
    Join Date
    Feb 2007
    Posts
    90
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you but where do i find the "Global" thingy xd

  14. #14
    ReidE96's Avatar Archer Authenticator enabled
    Reputation
    470
    Join Date
    Dec 2006
    Posts
    1,625
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anywhere inside the main class

    Code:
    Public Class frmMain
          Dim FormX, FormY as Integer

  15. #15
    Spot_1337's Avatar Active Member
    Reputation
    16
    Join Date
    Feb 2007
    Posts
    90
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    error xd (Me.Location.Y and Me.Location.X)
    expression is a value and therefore cannot be the target of an assignment
    Private Sub CheckBox1_locationchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.LocationChanged
    If CheckBox1.Checked Then
    Me.Location.X = FormX
    Me.Location.Y = FormY

Page 1 of 2 12 LastLast

Similar Threads

  1. [Question] weapon editing with itemcache.
    By Daimao in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 10-03-2007, 07:42 PM
  2. [Question] Need help with Editing...
    By Gerudion in forum WoW ME Questions and Requests
    Replies: 9
    Last Post: 10-01-2007, 07:38 PM
  3. Question: Fly mode with WoWemuhacker on Emu servers
    By Bareno in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 09-30-2007, 03:37 PM
  4. QUESTION: Druid form changes
    By Inevitable in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 07-22-2007, 08:57 PM
  5. WTT 57 UD lock PVP with BC
    By Glynbeard in forum Members Only Accounts And CD Keys Buy Sell
    Replies: 0
    Last Post: 02-25-2007, 09:31 AM
All times are GMT -5. The time now is 02:36 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search