Adding an item to a Checked List Box

VB.NET

    Next

  • 1. Problem for deploying Windows Forms Application with Crystal Report.
    Dear all, I have used Setup Winzard to deploy a windows application with crystal viewer to show a crystal report. I am using vb.net 2003. However, after I have installed the Setup in a computer with no vs.net and crystal report. The crystal report cannot be shown. The error message is : Cannot find KeycodeV2.dll, or invalid keycode. Please help. Thanks a lot, Ray
  • 2. App lockup
    Hi guys A have an application for proccessing some sensitive data, which is most of the time displayed on app windows. I want after some time of inactivity the application to become locked - its windows to be hiden or something and a form to be displayed, so the user can enter his username and password. When starting this app, users have to login and I automaticly logout them when they close the app. But when the application is locked, I don't want to logout users, because the will lose any changes done. I only want to hide the app windows. What I don't know how to track the user inactivity and how to hide all currently opened form of my app (the user may have couple of forms opened). TIA P.S. By inactivity I mean that the user don't move the mouse or use the keyboard (kind of what windows screen saver tracks), because the user may just look at the application forms without intecating with my app, but work with something else.
  • 3. How to color each entire datagrid columns in VB .Net ??
    Hi, Developping in VB. Net 2003 I am displaying data for 3 months on a datagrid and wish to color columns for 1st month lets say in gray, columns for 2nd month in blue, and columns for 3rd month in green. How do I do that ? Can't see anything in tablestyle or under datgrid properties. Any help is appreciated? Thanks for your help Thomas
  • 4. Checkbox and Databinding at Design time
    I binding controls to a dataset at design time. I find the checkboxs will cause the program crash when one of these databinding fields is dbnull. The only way for me is not set databindings for the checkboxs and adding code after fill the dataset and before update the dataset. I bind them to the checked property Is there some easy way to set databinding for checkbox? Thanks

Re: Adding an item to a Checked List Box

Postby Simon Jefferies » Sat, 17 Apr 2004 17:47:21 GMT

Thanks for your reply,

When I created a new project it worked! Mmmm...

I haven't touched the Windows Form designer generated code section.

Any ideas on what to try next?

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto: XXXX@XXXXX.COM 
www.headfirst.co.uk www.callofcthulhu.com
-










Re: Adding an item to a Checked List Box

Postby adamz5 » Sat, 17 Apr 2004 19:59:50 GMT

Just to make sure the code is in the right place.
Can you put the code behind a command button and try it. should work fine..

Re: Adding an item to a Checked List Box

Postby Simon Jefferies » Sat, 17 Apr 2004 20:43:20 GMT

Hello,

I've put the code behind a command button to perform the following:

        clbWaves.BeginUpdate()
        clbWaves.Items.Clear()
        clbWaves.Items.Add("Hello", True)
        clbWaves.EndUpdate()

and it still comes up with the exception...

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto: XXXX@XXXXX.COM 
www.headfirst.co.uk www.callofcthulhu.com
-







Re: Adding an item to a Checked List Box

Postby Armin Zingler » Sat, 17 Apr 2004 21:23:31 GMT

"Simon Jefferies" < XXXX@XXXXX.COM > schrieb

Could you please post all the code in the "Windos Form designer.." region
that uses clbWaves?


-- 
Armin

How to quote and why:
 http://www.**--****.com/ 
 http://www.**--****.com/ 


Re: Adding an item to a Checked List Box

Postby jonjo » Sat, 17 Apr 2004 23:12:52 GMT

> I am trying to add an item to a checked list box, like:

true is a boolean but its integer representation is -1. 
It maybe that this suggests that the 2nd parameter was expecting an integer?

Jonathan

Re: Adding an item to a Checked List Box

Postby Simon Jefferies » Sat, 17 Apr 2004 23:20:12 GMT

Hello,

I've just double-checked the 2nd parameter and it is "IsChecked" and it 
requires a boolean.

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto: XXXX@XXXXX.COM 
www.headfirst.co.uk www.callofcthulhu.com
-







Re: Adding an item to a Checked List Box

Postby johnei » Sun, 18 Apr 2004 01:48:45 GMT

i, Simon

I think it really depends on whether your first priority is getting it
working or figuring out what happened. In the former case I would recreate
the for in a new project, pasting your code ONLY from the old to the new.
If that works, dive into the form designer code and look for differences.

If you have to know what happened, try pealing the onion. Chop away what
should be irrelevant code and controls is small chunks until things start
working. Put the last piece back and see if it fails. Then go over the 2
files with a fine tooth comb. Something should be obvious.

Hope this helps,

John Eikanger
Microsoft Developer Support

This posting is provided S ISwith no warranties, and confers no rights.
--------------------
| From: "Simon Jefferies"<< XXXX@XXXXX.COM >>
| Subject: Re: Adding an item to a Checked List Box
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Thanks for your reply,
|
| When I created a new project it worked! Mmmm...
|
| I haven't touched the Windows Form designer generated code section.
|
| Any ideas on what to try next?
|
| Regards
| Simon Jefferies
| Tools Programmer, Headfirst Productions
| mailto: XXXX@XXXXX.COM
| www.headfirst.co.uk www.callofcthulhu.com
| -
| "John Eikanger [MSFT]"<< XXXX@XXXXX.COM >> wrote in message
| news: XXXX@XXXXX.COM ...
|>> Hi, Simon
|>>
|>> I can't get it to repro here either.
|>>
|>> What happens when you start a new project, add a checked list box & a
|>> button, and put your code in the button's click event? If that works,
|>> there is probably something wrong in your form or project files. Have
you
|>> edited the code in the Windows Form Designer generated code section?
That
|>> could be the culpret. If the simple project fails, please zip up the
|>> simple project and attach it to a post. That will give us something
real
|>> to play with.
|>>
|>> Hope this helps,
|>>
|>> John Eikanger
|>> Microsoft Developer Support
|>>
|>> This posting is provided "AS IS" with no warranties, and confers no
|>> rights.
|>> --------------------
|>> | From: "Simon Jefferies"<< XXXX@XXXXX.COM >>
|>> | Subject: Re: Adding an item to a Checked List Box
|>> | Date: Thu, 15 Apr 2004 15:57:44 +0100
|>> | X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|>> |
|>> | I don't get an exception when I comment out the BeginUpdate, Clear and
|>> | EndUpdate.
|>> |
|>> | I put back in the Clear() and its still working, so it means
|>> BeginUpdate()
|>> | or EndUpdate() or both causes this problem?
|>> |
|>> | Yes, I am performing this in the main application thread.
|>> |
|>> | Why would this happen?
|>> |
|>> | --
|>> | Regards
|>> | Simon Jefferies
|>> | Tools Programmer, Headfirst Productions
|>> | mailto: XXXX@XXXXX.COM
|>> | www.headfirst.co.uk www.callofcthulhu.com
|>> | -
|>> | "Herfried K. Wagner [MVP]"<< XXXX@XXXXX.COM >> wrote in message
|>> | news: XXXX@XXXXX.COM ...
|>> |>> Simon,
|>> |>>
|>> |>> * "Simon Jefferies"<< XXXX@XXXXX.COM >> scripsit:
|>> |>>> clbWaves.BeginUpdate()
|>> |>>> clbWaves.Items.Clear()
|>> |>>> Try
|>> |>>> clbWaves.Items.Add("Hello", True)
|>> |>>> Catch ex As Exception
|>> |>>> End Try
|>> |&g

Re: Adding an item to a Checked List Box

Postby hirf-spam-me-here » Sun, 18 Apr 2004 06:04:26 GMT

* "Simon Jefferies" < XXXX@XXXXX.COM > scripsit:

I have tested it on my VS.NET 2003 machine -- not able to repro the
problem...

-- 
Herfried K. Wagner [MVP]
<URL: http://www.**--****.com/ ;

Re: Adding an item to a Checked List Box

Postby hirf-spam-me-here » Sun, 18 Apr 2004 06:05:00 GMT

* "Simon Jefferies" < XXXX@XXXXX.COM > scripsit:

That's what MSDN says too.

-- 
Herfried K. Wagner [MVP]
<URL: http://www.**--****.com/ ;

Re: Adding an item to a Checked List Box

Postby johnei » Wed, 21 Apr 2004 03:10:49 GMT

i, Simon

The problem seems to be setting the Sorted property to True. The following
works for me:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

clbWaves.BeginUpdate()
clbWaves.Sorted = False
clbWaves.Items.Clear()
clbWaves.Items.Add("Hello", True)
clbWaves.Sorted = True
clbWaves.EndUpdate()
End Sub

As to >why< Sorted causes problems, that will take some research. I will
let you know what I find out.

Thank you for choosing the MSDN Managed Newsgroups,

John Eikanger
Microsoft Developer Support

This posting is provided S ISwith no warranties, and confers no rights.
--------------------
| From: "Simon Jefferies"<< XXXX@XXXXX.COM >>
| Subject: Re: Adding an item to a Checked List Box
| Date: Mon, 19 Apr 2004 10:03:43 +0100
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Thanks for your help,
|
| I've created a new form, and copied the problem code across. I've
stripped
| out all my events etc leaving just a simple button click event to add
items
| to the checked list box. It still doesn't work. I've compared a working
form
| with the unworking one and cant see anything that would cause this
problem.
|
| I've attached the project - two forms inside, Form1 (not working) and
| WorkingForm.
|
| Please let me know if you find anything thats wrong with this form.
|
| Regards
| Simon Jefferies
| Tools Programmer, Headfirst Productions
| mailto: XXXX@XXXXX.COM
| www.headfirst.co.uk www.callofcthulhu.com
| -
| "John Eikanger [MSFT]"<< XXXX@XXXXX.COM >> wrote in message
| news: XXXX@XXXXX.COM ...
|>> Hi, Simon
|>>
|>> I think it really depends on whether your first priority is getting it
|>> working or figuring out what happened. In the former case I would
|>> recreate
|>> the for in a new project, pasting your code ONLY from the old to the
new.
|>> If that works, dive into the form designer code and look for
differences.
|>>
|>> If you have to know what happened, try pealing the onion. Chop away
what
|>> should be irrelevant code and controls is small chunks until things
start
|>> working. Put the last piece back and see if it fails. Then go over
the 2
|>> files with a fine tooth comb. Something should be obvious.
|>>
|>> Hope this helps,
|>>
|>> John Eikanger
|>> Microsoft Developer Support
|>>
|>> This posting is provided "AS IS" with no warranties, and confers no
|>> rights.
|>> --------------------
|>> | From: "Simon Jefferies"<< XXXX@XXXXX.COM >>
|>> | Subject: Re: Adding an item to a Checked List Box
|>> | X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|>> |
|>> | Thanks for your reply,
|>> |
|>> | When I created a new project it worked! Mmmm...
|>> |
|>> | I haven't touched the Windows Form designer generated code section.
|>> |
|>> | Any ideas on what to try next?
|>> |
|>> | Regards
|>> | Simon Jefferies
|>> | Tools Programmer, Headfirst Productions
|>> | mailto: XXXX@XXXXX.COM
|>> | www.headfirst.co.uk www.callofcthulhu.com
|>> | -
|>> | "John Eikanger [MSFT]"<< XXXX@XXXXX.COM >> wrote in message
|>> | news: XXXX@XXXXX.COM ...
|>> |>> Hi, Simon
|>> |>>
|>> |>> I can't get it to repro here either.
|>> |>>
|>>

Re: Adding an item to a Checked List Box

Postby johnei » Wed, 21 Apr 2004 03:37:43 GMT

Found it.  Known bug that we found too late to get into 7.1

The problem is that you call BeginUpdate, so all additions have to wait 
until after the EndUpdate.  The problem is that the we try to set the 
checked state immediately and the there is nothing there yet to send.  It 
isn't clear why Sorted makes a difference

Please try the work around that I provided and let me know if it works for 
you.

John Eikanger
Microsoft Developer Support

This posting is provided S ISwith no warranties, and confers no rights.


Re: Adding an item to a Checked List Box

Postby Simon Jefferies » Wed, 21 Apr 2004 17:48:36 GMT

Many thanks for replying and finding out what the problem was.

I have tried the workaround and it works! :-)

Best Wishes
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto: XXXX@XXXXX.COM 
www.headfirst.co.uk www.callofcthulhu.com
-








Return to VB.NET

 

Who is online

Users browsing this forum: No registered users and 82 guest