How to check/uncheck a standard (non udf) checkbox
fwdIT
I have already spent hours trying to do something not that complicated (in my opinion). But it doesn't seem to be that easy to change the state of a standard (non user defined) checkbox from within a VBCODE snippet in Coresuite.
I have read different sites and forums, also searched for C# code but most of the small amount of info I can find is concerning user defined checkbox objects which you need to databind. As far as I understand, this checkbox (BlockDunn, see code below) is already databound. I tried to add a datasource also but it gave me this notification so I am becoming clueless what else to try.
With this code I can change the label (.value) of the checkbox without a problem, the checkbox itself doesn't change state at all.
form rule code:
Try
Dim oblockDunn As SwissAddonFramework.UI.Components.CheckBox = CheckBox.GetFromUID(pVal.Form, "193")
Dim bnpFact As String = Matrix.GetFromUID(pVal.Form, "136").GetValue("2", 9)
If (bnpFact = "Y") Then
oblockDunn.Checked = True
End If
If (bnpFact = "N") Then
oblockDunn.Checked = False
End If
Catch ex As Exception
customize.Messaging.Debug.WriteMessage("Error in coresuite customize Rule (TEST): " & ex.ToString(), customize.Messaging.Debug.DebugLevel.Exception)
End Try
The code would logically force the checked state to Y or N but it doesnt do anything No exception either...
If I check the state of BlockDunn before my action, it is false. Then I do .checked = True and afterwards I check again but the state is still false. If i check BlockDunn checkbox manually and run the code again it sees that I checked it but I cannot do this with this code.
Screenshot of the Optimizer screen in attachment. I also tried triggering the code from a click event on the Matrix object instead of the Update button but that doesn't make a difference either. The trigger in any case execute the code but sadly the checkbox state doesn't change in any way I try.
Does anyone see what I am doing wrong ?
fwdIT
I suspect it is not as easy as I thought :)
Konstantin
Hi,
try it with
oblockDunn.Click(SwissAddonFramework.UI.Components.Item.ClickType.Regular)
It should do the same as if you clicked the checkbox yourself.
fwdIT
Hi, thx for the tip ! Sadly the checkbox stays unchanged with this command. I output checkbox status/value before and after the command and check visually but it doesn't seem to change :/
Please sign in to leave a comment.
Comments
0 comments