Click here to Skip to main content
15,892,199 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow to get the item's data type in an bound Bindingsource that actually is empty? Pin
dilkonika16-Apr-15 19:45
dilkonika16-Apr-15 19:45 
QuestionGet the primary key property name and the Foreign key property name of an arbitrary entity Pin
dilkonika16-Apr-15 16:56
dilkonika16-Apr-15 16:56 
AnswerRe: Get the primary key property name and the Foreign key property name of an arbitrary entity Pin
dilkonika19-Apr-15 4:56
dilkonika19-Apr-15 4:56 
Questionvb.net 2010 sum value in a collectionh Pin
dcof16-Apr-15 11:48
dcof16-Apr-15 11:48 
AnswerRe: vb.net 2010 sum value in a collectionh Pin
Sascha Lefèvre16-Apr-15 12:27
professionalSascha Lefèvre16-Apr-15 12:27 
GeneralRe: vb.net 2010 sum value in a collectionh Pin
dcof17-Apr-15 4:17
dcof17-Apr-15 4:17 
GeneralRe: vb.net 2010 sum value in a collectionh Pin
Sascha Lefèvre17-Apr-15 6:07
professionalSascha Lefèvre17-Apr-15 6:07 
QuestionCreate a list of Unknown type at compile time Pin
dilkonika16-Apr-15 10:58
dilkonika16-Apr-15 10:58 
Hello !
It's possible to create a list of unknown type at compile time ?
Let's suppose the type is in one variable as a string.
And I want to create a list of this type , and of course after I want to add items from this type to the list.

I have found this code on C# , but it seems not work on vb.net :
// Create a List<> of unknown type at compile time.
Type customList = typeof(List<>).MakeGenericType(tempType);
IList objectList = (IList)Activator.CreateInstance(customList);

// Copy items from a PropertyInfo list to the object just created
object o = objectThatContainsListToCopyFrom;
PropertyInfo p = o.GetType().GetProperty("PropertyName");
IEnumerable copyFrom = p.GetValue(o, null);
foreach(object item in copyFrom) objectList.Add(item); // Will throw exceptions if the types don't match.

// Iterate and access the items of "objectList"
// (objectList declared above as non-generic IEnumerable)
foreach(object item in objectList) { Debug.WriteLine(item.ToString()); }

I just want to create the list , and after to add items like this :
List1.Items.Add(object).

What can I do ?
Thank you !
AnswerRe: Create a list of Unknown type at compile time Pin
Sascha Lefèvre16-Apr-15 11:02
professionalSascha Lefèvre16-Apr-15 11:02 
GeneralRe: Create a list of Unknown type at compile time Pin
dilkonika16-Apr-15 11:53
dilkonika16-Apr-15 11:53 
GeneralRe: Create a list of Unknown type at compile time Pin
Sascha Lefèvre16-Apr-15 12:15
professionalSascha Lefèvre16-Apr-15 12:15 
GeneralRe: Create a list of Unknown type at compile time Pin
dilkonika16-Apr-15 13:05
dilkonika16-Apr-15 13:05 
GeneralRe: Create a list of Unknown type at compile time Pin
Sascha Lefèvre16-Apr-15 13:14
professionalSascha Lefèvre16-Apr-15 13:14 
GeneralRe: Create a list of Unknown type at compile time Pin
dilkonika16-Apr-15 13:51
dilkonika16-Apr-15 13:51 
GeneralRe: Create a list of Unknown type at compile time Pin
Sascha Lefèvre16-Apr-15 14:18
professionalSascha Lefèvre16-Apr-15 14:18 
GeneralRe: Create a list of Unknown type at compile time Pin
dilkonika16-Apr-15 14:23
dilkonika16-Apr-15 14:23 
GeneralRe: Create a list of Unknown type at compile time Pin
Sascha Lefèvre16-Apr-15 14:39
professionalSascha Lefèvre16-Apr-15 14:39 
GeneralRe: Create a list of Unknown type at compile time Pin
dilkonika16-Apr-15 16:03
dilkonika16-Apr-15 16:03 
GeneralRe: Create a list of Unknown type at compile time Pin
Sascha Lefèvre17-Apr-15 2:53
professionalSascha Lefèvre17-Apr-15 2:53 
QuestionExtended ASCII with UTF-8 in VB.NET Pin
r_m_radha15-Apr-15 2:28
r_m_radha15-Apr-15 2:28 
AnswerRe: Extended ASCII with UTF-8 in VB.NET Pin
Richard MacCutchan15-Apr-15 2:41
mveRichard MacCutchan15-Apr-15 2:41 
GeneralRe: Extended ASCII with UTF-8 in VB.NET Pin
r_m_radha15-Apr-15 17:44
r_m_radha15-Apr-15 17:44 
GeneralRe: Extended ASCII with UTF-8 in VB.NET Pin
Richard MacCutchan15-Apr-15 21:30
mveRichard MacCutchan15-Apr-15 21:30 
QuestionHashSet(Of T) - how can I get elements by position number ? Pin
dilkonika14-Apr-15 12:20
dilkonika14-Apr-15 12:20 
GeneralRe: HashSet(Of T) - how can I get elements by position number ? Pin
PIEBALDconsult14-Apr-15 12:55
mvePIEBALDconsult14-Apr-15 12:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.