Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

problem with property filed list for labels.

1 REPLY 1
Reply
Message 1 of 2
joantopo
235 Views, 1 Reply

problem with property filed list for labels.

I have practiced this exercise:

http://www.inmotioncon.com/Downloads/Nothing%20but%20.Net-Handout.pdf

It´s great this document!

 

 

 

 

 

In the windows form, there are:

 

 

Friend aligns As List(Of Objects.BaseObject)

.........
Me.dgvAlign.DataSource = aligns
Me.cboStyle.DataSource = aStyles
Me.cboStyle.DisplayMember = "Name"
Me.cboStyle.ValueMember = "Id"

 

But I´m traying the following:

 

I have some labels and I want show different alignments properties depending The alignment selected in the combobox.

 

private void cboStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
	string s = ((aligns)cboStyle.SelectedItem).Name;
	label1.text=s
	}

 


 But Visual Studio say me:   "aligns" is "filed" but it  uses as a "type".

 

What can I do? I must use ArrayList? I must create a new class for align?

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
1 REPLY 1
Message 2 of 2
Daniel.Du
in reply to: joantopo

You are trying to do force conversion here, to convert cboStyle.SelectedItem to Alignment type, it should be a type name:

 

string s = ((Alignment)cboStyle.SelectedItem).Name;


Daniel Du
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report