Determining Type of Dynamically Created Controls - vba

I have a Userform that populates a series of Check boxes, Text boxes, and Combo boxes based on the content of a dictionary. The initialization of the Userform dynamically creates all the Control Objects and names them according to the type of control that they are and an index I have provided that corresponds to the dictionary object they were generated from. After the user interacts with the Userform, they click a button to process the results and the information in the controls are written to a class object for use in the next step of the program.
I need to be able to loop through the different controls objects, determine type of control that it is (ProgID), and check data/value within the object. I am having trouble finding an identifier that will allow me to differentiate between the various types of controls.
Currently, I am looping through the UserForm.Controls.Item list to have the objects returned to me. I cannot find any method of identifying the type of control from this object to determine what information needs to be pulled from it. Each type of control is written to a different property of the Class object.
Too Long; Didn't Read:
I need a way to determine the ProgID (or equivalent identifier) of an object returned from the Userform.Controls.Item function.

Related

Parameters in CATIA VBA

In CATIA, every feature have its own properties corresponding to specific addresses representing it. For example, pad.1 feature has FirstLimit as a property with Length as a parameter of it (as see in the picture). Is it possible to work with this available and default parameters or properties or features through VBA, to, for instance, change the value of some of those parameters, as the way I work with Formulas dialogue as shown in the attached picture.

Visual Basic 2010 - Referencing objects in different user controls

For an app that uses user controls instead of forms and the first user control has a listview, where the user clicks or selects "Create New" Or Delete, what is the best way to transfer the data selected in the listview to the detail screen (separate User Control) where the data can be edited?
Can I just reference the list view in the first UC in the Details UC? something like:
ucHeader.lvSetups.FocusedItem.SubItems.Count = 0
from the ucDetail user control?
Saying which way is the best would produce a heated discussion with every ones opinion. However, here are a few ways I would tackle this. While there are more options, these are what I would do:
You should expose any information you want to read from a user control in the form of a property, readonly if you must. Just an example because I don't know what your object types are:
Public ReadOnly Property SelectedItem as object
get
Return Listview1.SelectedValue
end get
End Property
You can also use events to tell the parent of your user control that a selection was made. You can pass whatever you want in this event, even the selected object. If you don't want to pass the selected object, grab it from the property you created (like #1) in the event handler.

Cocoa Bindings with NSComboBox

I have Cocoa Bindings working with a NSComboBox that shows and autocompletes values based on a Managed Object Context. My issue is trying to get the current selection after the user either selects from the dropdown or the autocomplete text is used. I know that the Array Controller class has a selected objects property, but when I try to use it to pull out the selected object I get nothing. With a NSComboBox do I have to set the selection once the text/selection of the combo box occurs or is there something I'm missing setting up the Array Controller.
Thanks
A combo box allows any arbitrary string to be entered, right? (You're not limited to the items you can autocomplete, unlike a popup menu.) So it doesn't have a concept of selected item, since the text in it might not correspond to any item in your database.
This question seems to address a similar issue, declaring it to be unsolvable using only bindings, and links to a blog post that has some hints on what code needs to be added. The gist of it is that, when the user finishes editing the combo box, you create your own fetch request in code and use the response from that to link up the model.

VB.net User Control Issues

I've created one user control which have textBox & DatabGridView etc. When any user start typing in textbox then the filter is applied in DatabGridView. Now I want to add following features in this control how can I add these?
I want to use same control for supplier, customer, vendors on a single form, so I've placed it 3 times from toolbar. But for each control I want to fill different data from database. So what will be the best way to bind the control?
As we knew each table (customer,supplier & vendor) can have different columns, so I also need properties to set them. I've added property to my control but how can I ensure user has assign value in it? I.e. if user run the form and X property is not assigned to control then it should show message.
Note: I've tried it on control load event but didn't get any success because control's load event is occurred prior to form load and I'm assigning property on form load.
Please help....

vfp9 'THIS' equivalent to vb.net

In VFP9 there is an object reference THIS which provides a reference to the current object in event code or in a class definition. In vb.net there is ME but as i observed it referred to the actual form not the object itself.
VFP Code for button1 click:
this.caption = "CLICKED" <<OR>> thisform.button1.caption = "CLICKED"
VB Code
----------------------- <<OR>> Me.button1.text="CLICKED"
I want to know the dotted line equivalent in vb.net, a reference to the current object. We have an VFP9 system and I'm trying to convert it to vb.net.
VFP works based on nested object references for the controls and "this" allows the capability of relative reference. If you wanted to long-hand the VFP equivalent, it would be something like
Thisform.button1.Caption = "CLICKED"
Now, that said, you may encounter other controls downstream in your conversion that look something like...
this.Parent.otherControl.something...
The ".Parent" just refers to the parent control of the current object. So, say you have a form with a pageframe... On that are 3 pages. On Page 1 has a container. That container has a textbox and a button.
In the click of the button, you want to display a message of the value in the textbox control. The button may have something like
Messagebox( This.Parent.TheTextBoxControl.Text )
You don't have to know how deep the container is buried in the form, you just know that the textbox is relative to the button via the same parent control.