취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

Programatically getting a .NET PictureBox label

해결 완료!
솔루션으로 이동

Hey folks, hope you're well.

 

Having difficulty getting the label string of a .NET PictureBox (System.Windows.Forms.PictureBox) inside of LabVIEW.

Has anyone successfully managed this before? Would appreciate a couple of pointers!

0 포인트
1/6 메시지
2,516 조회수

Not exactly sure what you're asking.

 

Did you add a .NET container to the front panel, load the PictureBox control in it, and now want to read the label?

 

If so, you should be able to just right-click and create a property node for the terminal and read the label text just like any other LabVIEW terminal:

Kyle97330_0-1666634390538.png

 

2/6 메시지
2,482 조회수

Thanks for the response, that's definitely a good way of doing it with connected property nodes.
My apologies for not specifying with more detail - I'd like to be able to pass the reference from a picture box to a property node further down, in order to read the corresponding LabVIEW label.

 

lima_97_0-1666684754879.png

 

When I try and do this, the property node "switches" target class, and no longer has the property. I'm assuming I could typecast to a more specfic class, but I'm not having much luck trying to do that. Any thoughts?

0 포인트
3/6 메시지
2,454 조회수
솔루션
주제 작성자 lima_97이(가) 승인함

It seems you can not get the refnum of the .net container from the PictureBox.

But the can get container refnum from VI Server.

Untitled.pngUntitled.jpg

 

George Zou
4/6 메시지
2,428 조회수

@lima_97 wrote:

I'd like to be able to pass the reference from a picture box to a property node further down, in order to read the corresponding LabVIEW label.

 

lima_97_0-1666684754879.png

 

When I try and do this, the property node "switches" target class, and no longer has the property. I'm assuming I could typecast to a more specfic class, but I'm not having much luck trying to do that. Any thoughts?


 

In your code, you're using the .NET reference returned by the terminal, which gives you access to the properties of the inserted control.

 

What you actually want is a reference to the container, which you can get in the way zou showed, or more easily by right clicking the control or the terminal and selecting Create>>Reference.


___________________
Try to take over the world!
5/6 메시지
2,393 조회수

Thankyou both for your response, the method of accessing the text property via VI server worked great!

Attached below is what I ended up doing:

 

lima_97_0-1666771455393.png

 

 

I get the inserted object inside the container, cast it to a .NET object type, then typecast that to the specific class.

0 포인트
6/6 메시지
2,377 조회수