dcsimg
Results 1 to 9 of 9

Thread: VB.Net Custom ON and OFF Slide control

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    VB.Net Custom ON and OFF Slide control

    Hi Again All,

    So this time i'm sharing my "Slider" control. This is a on and off button that is designed to work around touch screens (but will work well with a mouse).

    The different states look like below

    Name:  slider.PNG
Views: 3284
Size:  4.0 KB

    The control will change its state by the user either touching (clicking) the option such as on or by the user dragging the cover to the other side of the control, so long as they get more than half way. if they don't then the control will stay at its last state.

    Using the control is easy enough, drag it from the toolbox (once you have added it) and place it on a form. To programatically (spelling? chrome doesn't know the word) move its state you can do the following:

    Code:
    'to turn the control to its off state call
    Slider1.offme()
    
    'to turn the control to its on state call
    Slider1.onme()
    The control is only useful if you can also read its state, this is done like so (note: the value returns as a boolean, true for on and false for off).

    Code:
    'check state
    If Slider1.sety = True Then
    'Slider control is ON
    End If
    That's all there really is to it, the size of the control is fixed (it is changeable but may cause issues), the size is perfect of touch screens and has been tested in real life business environments (a handful but consistently ).

    Hope someone finds this handy/useful




    Moderator Edit> Potentially malicious file removed
    Last edited by FunkyDexter; Jun 30th, 2018 at 03:14 AM.
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  2. #2
    New Member
    Join Date
    Jun 2018
    Posts
    1

    Re: VB.Net Custom ON and OFF Slide control

    Hello bensonsearch,

    I liked the switch control you poted and would like to use it in my project. However, I am newby on VB.Net and could not succeed to integrate in my project. I am using Visual Studio 2015. Could you please briefly describe the steps to integrate the switch button in my project.

    Thanks in advance.
    Best regards,

    Sahin.

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    101,994

    Re: VB.Net Custom ON and OFF Slide control

    Interestingly, I just tried to download the attachment and Windows Defender told me that it contained a virus. Not sure whether that's a false positive but it's certainly something to look into.
    Quote Originally Posted by kayasahin View Post
    I liked the switch control you poted and would like to use it in my project. However, I am newby on VB.Net and could not succeed to integrate in my project. I am using Visual Studio 2015. Could you please briefly describe the steps to integrate the switch button in my project.
    As I'm here, I'll field that question. As I can't safely download the attachment, I'm not sure exactly what's in it. I would expect that it would be a VS solution. You basically have three choices of what to do:

    1. In your own project, right-click the project in the Solution Explorer and select Add -> Existing Item and then navigate to the class file for the control in the downloaded project. You would need to add any other dependencies as well, e.g. resource images, if there are any. That custom control is then part of your project, like any other type. Once you build the solution, you'll find the control in the Toolbox.

    2. Similar to option 1 but instead of adding an existing item to your project, you add an existing project to your solution. The original project won't be moved or copied but simply referenced in-place by your solution. The advantage of doing this over option 1 is that you only have one version of the code so any changes you might make will affect the original and thus be there if you add that same project to another solution later on.

    3. Build the original solution and then add the control to the Toolbox. To do that, right-click the Toolbox and select Choose Items and then navigate to the DLL you built. After that, you can add the control to any form in any project just like you do for any other control.

  4. #4
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,197

    Re: VB.Net Custom ON and OFF Slide control

    I just tried to download the attachment and Windows Defender told me that it contained a virus.
    That's worrying but I'm not in a position to check it right now. Have messaged the other mods and hopefully one of them will be able to take a look. If not I'll check it over the weekend.

    Benson's a long standing and trusted member so I'm disinclined to remove it until we've checked it's not a false positive. In the meantime, anyone who downloads it does so at their own risk - personally I'd advise against it for now.

    Am editing Bensons post to highlight the risk in the meantime.

    @Benson> does the attachment include any compiled elements? If so, could you remove them as per the forum rules?




    Edit> OK, I tried downloading it on a safe machine with exactly the same result. @Benson, I'm afraid I've removed the file.
    Last edited by FunkyDexter; Jun 30th, 2018 at 03:16 AM.
    You can depend upon the Americans to do the right thing. But only after they have exhausted every other possibility - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  5. #5
    Addicted Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Posts
    227

    Re: VB.Net Custom ON and OFF Slide control

    Benson, maybe check your system for any hitchhiking viruses. These things are so easy to pick up.

  6. #6
    Hyperactive Member
    Join Date
    May 2013
    Posts
    295

    Re: VB.Net Custom ON and OFF Slide control

    This is pretty cool. Has the attachment issue been resolved yet?
    Lo And Behold
    This is my first Microsoft App Submission
    Your opinion of it would be appreciated

  7. #7
    New Member
    Join Date
    Mar 2019
    Posts
    2

    Re: VB.Net Custom ON and OFF Slide control

    where is the attachment? How to download it?

  8. #8
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    101,994

    Re: VB.Net Custom ON and OFF Slide control

    Quote Originally Posted by Kartz View Post
    where is the attachment? How to download it?
    As has been said in the thread, it was being flagged as potentially malware so has been removed.

  9. #9
    New Member
    Join Date
    Mar 2019
    Posts
    2

    Re: VB.Net Custom ON and OFF Slide control

    Quote Originally Posted by jmcilhinney View Post
    As has been said in the thread, it was being flagged as potentially malware so has been removed.
    Ok Fine. Please share the code in other format to explore.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width