Use the checkbox in word to explore attributes/methods)

Source: Internet
Author: User

When using checkbox for the first time, there is no way to get the checkbox value (true or false)

The syntax is as follows:

Mycheckbox. value, but it is a pity that the value type is object, and then I put it tostring () is also futile :(

 

Then, based on the information provided by the compiler:

The attribute, indexer, or event "value" is not supported by this language. Please try to directly call the accesser method "Microsoft. VBE. interOP. forms. imdccheckbox. get_value () "or" Microsoft. VBE. interOP. forms. imdccheckbox. set_value (ref object )"

 

Then, press get _ and then intelligently perceive (CTRL + J ,. in the net2003 Environment). I have to write it all, compile it, haha, And you can compile it. It seems that Microsoft has not completely encapsulated all the properties of these controls.

 

The following code finally obtains the value:

If (Boolean. parse (mycheckbox. get_value (). tostring ()))

{

MessageBox. Show ("OK ");

}

 

Also, I want to see

Using Office = Microsoft. Office. core;

Using word = Microsoft. Office. InterOP. word;

Using msforms = Microsoft. VBE. InterOP. forms;

What exactly are there in these three namespaces? Unfortunately, I didn't install these in msdn,Which one can provide the relevant patch??

 

The following lists the checkbox items.

Important attributes

Mycheckbox. Caption; // The name string displayed in checkbox

Mycheckbox. enabled; // whether the checkbox is available bool

Mycheckbox. groupname; // set string for the checkbox Group

Mycheckbox. Locked; // the checkbox is locked and bool cannot be selected.

Mycheckbox. multiselect // checkbox you can select multiple fmmultiselect

Mycheckbox. Value // whether the checkbox object is selected

 

Important events

Mycheckbox. Change + = new msforms. mdccheckboxevents_changeeventhandler (mycheckbox_change );

 

 

Source: http://www.cnblogs.com/koffer/archive/2004/09/25/46668.html

 

After referring to the above Code, my problem is solved as follows:

Prjbusinessrules. B _semiin bsemiin = factory. getbsemiin ();
Prjcommon. c_semiin csemiin = bsemiin. getsemiinbyrollno (rollno );
If (csemiin. get_icommon_data (). recordcount = 0 ){
Throw new exception ("the current bind warehouse receiving ticket does not contain a record with the volume number:" + rollno +! ");
}
Csemiin. get_icommon_data (). Fields [csemiin. Processing]. value = processing;
Bsemiin. Repeated stocksforwaiting (ref csemiin, place, qualityid, beltstatus, remark );

 

In addition, I found that this problem is caused by the C # indexer. When the parameter is of the value type, it should be a value-passing operation, this problem occurs if the class attribute in the COM component is in the form of an address transfer. in this case, you can modify the attributes of the class you write, for example:

Public proeprty let myproperty (byval tvalue as string)

'Your code

End Property

 

However, you can only use the above method for attributes in a class library that are not compiled by yourself.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.