10 Replies - 419 Views - Last Post: 28 October 2011 - 11:14 PM Rate Topic: -----

#1 naveed_786  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 306
  • Joined: 13-October 09

Check Box Problem

Posted 28 October 2011 - 10:11 PM

Dear All,

I am trying to save "Closed" when i click on check box


here is my code


Private Sub chkwos_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkwos.CheckedChanged
        If chkwos.CheckState = "TRUE" Then
            chkwos.Text = "CLOSED"
        End If
    End Sub


i receive this error


Conversion from string "TRUE" to type 'Double' is not valid.

Is This A Good Question/Topic? 0
  • +

Replies To: Check Box Problem

#2 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 583
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Check Box Problem

Posted 28 October 2011 - 10:23 PM

There is no such property as "CheckState". I'm feeling quite good so here's the solution.
If chkwos.Checked = True then
Chkwos.Text = "Closed"
End If


this should work.
J-Bo
Was This Post Helpful? 0
  • +
  • -

#3 smohd  Icon User is online

  • Critical Section
  • member icon


Reputation: 1819
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: Check Box Problem

Posted 28 October 2011 - 10:26 PM

This line
 If chkwos.CheckState = "TRUE" Then
should be
 If chkwos.Checked = True Then
or simply If chkwos.Checked Then As you see I remove quotation from true to make it boolean. Also to check either selected or not, Checked property is the one, CheckState is used to get or set the state of checkbox. So better use Checked which set or get a value indicating if checkBox is in checked
Was This Post Helpful? 0
  • +
  • -

#4 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 583
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Check Box Problem

Posted 28 October 2011 - 10:30 PM

Duuuuude, I said that already.
Was This Post Helpful? 0
  • +
  • -

#5 smohd  Icon User is online

  • Critical Section
  • member icon


Reputation: 1819
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: Check Box Problem

Posted 28 October 2011 - 10:30 PM

View PostjimmyBo, on 29 October 2011 - 11:08 AM, said:

There is no such property as "CheckState".

Surely there is ;) CheckState is a property used to gets or sets the state of the System.Windows.Forms.CheckBox. And it returns one of the System.Windows.Forms.CheckState enumeration values. The default value is Unchecked.
Was This Post Helpful? 0
  • +
  • -

#6 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 583
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Check Box Problem

Posted 28 October 2011 - 10:33 PM

Really? Hmm, i never notice as I just use the .Checked property.
I was still right, though.
Was This Post Helpful? 0
  • +
  • -

#7 naveed_786  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 306
  • Joined: 13-October 09

Re: Check Box Problem

Posted 28 October 2011 - 10:39 PM

Same result here is code

If chkwos.Checked = True Then
            chkwos.Text = "CLOSED"
        End If



and here is my update statement

com = New OleDbCommand("UPDATE WO SET  COMPLETION_DATE = to_date('" & textDateTime & "','mm/dd/yyyy hh24:mi:ss'),ITEM_CODE = '" & Me.txtitmcode.Text.Trim & "',ITEM_NAME = '" & Me.txtitmname.Text.Trim & "',SUB_LOC = '" & Me.txtsubloc.Text & "',ADDED_DATE = to_date('" & textDateTime & "','mm/dd/yyyy hh24:mi:ss'),QTY = '" & Me.txtqty.Text & "', DONE_BY = '" & Me.txttper.Text & "',EMP_ID = '" & txtempid.Text & "',COMP_DU = '" & Me.txtcomdur.Text & "',PREP_BY = '" & Me.txtperby.Text & "',COMMENTS = '" & txtcom.Text & "', WO_USER ='" & txtusers.Text & "',REC_STATE = '" & chkwos.Checked & "' WHERE WO_NO ='" & txtcriteria.Text.Trim & "'", con)

Was This Post Helpful? 0
  • +
  • -

#8 smohd  Icon User is online

  • Critical Section
  • member icon


Reputation: 1819
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: Check Box Problem

Posted 28 October 2011 - 10:44 PM

Wait....Same result? Which one? first you said you get an error message "Conversion from string "TRUE" to type 'Double' is not valid."!
So if now you have another problem, tell us what is it and we are happy to help
Was This Post Helpful? 0
  • +
  • -

#9 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 583
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Check Box Problem

Posted 28 October 2011 - 10:46 PM

Instead of & chkwos.checked go for & chkwos.text.
J-Bo
Was This Post Helpful? 1
  • +
  • -

#10 naveed_786  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 306
  • Joined: 13-October 09

Re: Check Box Problem

Posted 28 October 2011 - 10:53 PM

@jimmyBo

Actually the problem was with ".checked" after changing to .Text it worked for me.

Thanks you solution has resolved my problem.
Was This Post Helpful? 1
  • +
  • -

#11 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 583
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Check Box Problem

Posted 28 October 2011 - 11:14 PM

Dude, you are totally welcome. Pleasure helping out!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1