Click here to Skip to main content
15,906,463 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Scheduler Application in VB.Net. Pin
mgilmore13-Feb-06 13:43
mgilmore13-Feb-06 13:43 
QuestionHow to upload webpages to the site Pin
Sgn_Flex12-Feb-06 22:27
Sgn_Flex12-Feb-06 22:27 
AnswerRe: How to upload webpages to the site Pin
Guffa13-Feb-06 0:20
Guffa13-Feb-06 0:20 
GeneralRe: How to upload webpages to the site Pin
Sgn_Flex13-Feb-06 0:44
Sgn_Flex13-Feb-06 0:44 
GeneralRe: How to upload webpages to the site Pin
Dave Kreskowiak13-Feb-06 5:52
mveDave Kreskowiak13-Feb-06 5:52 
QuestionBIOS changes Pin
rzvme12-Feb-06 22:07
rzvme12-Feb-06 22:07 
AnswerRe: BIOS changes Pin
Dave Kreskowiak13-Feb-06 5:50
mveDave Kreskowiak13-Feb-06 5:50 
QuestionHow to Create typeconverter dynamically by reflection to use in a PropertyGrid? Pin
Mohamed Ali Jinnah12-Feb-06 21:29
Mohamed Ali Jinnah12-Feb-06 21:29 
Hi,
I am using the propertygrid control to get the application level parameters from the users. The object assigned to the propertygrid is created dynamically with help of reflection.emit. i achieved the functionalities of the propertygrid like Categories and Description of a property by using the SetCustomAttribute method of a property builder.

I want to achieve the combo box functionality for a property (User can select a value from the combobox for the property). I know that we can achieve this by setting the TypeConverterAttribute for the property. My problem is, each property will have to show different values in the combo(Values are coming from a Database), so dynamically i have to create a TypeConverter which is inherited from StringConverter. This typeconverter should be assingned to the property by TypeConverterAttribute.

My problem is how we have to create a TypeConverter which is inherited from StringConverter with help of Reflection.Emit.

Please give you suggestions.

Please find the code below. It is not working. I confused to write the reflection related codes. Please help me on this.

Public Shared Function GetDynamicTypeConverted(ByRef foModuleBuilder As ModuleBuilder) As Type
Dim oTypeBuilder As TypeBuilder = Nothing
Dim oMethodBuilder As MethodBuilder = Nothing
Dim oILGenerator As ILGenerator = Nothing
Dim oConstructorInfo As ConstructorInfo = Nothing
Dim oParams() As Type
Try
oTypeBuilder = foModuleBuilder.DefineType("EngStatusConverter", TypeAttributes.Class, GetType(StringConverter))

oMethodBuilder = oTypeBuilder.DefineMethod("GetStandardValuesSupported", MethodAttributes.Public, GetType(Boolean), New Type() {GetType(ITypeDescriptorContext)})
oILGenerator = oMethodBuilder.GetILGenerator
oILGenerator.Emit(OpCodes.Ldarg_0, CType(True, Object))
oILGenerator.Emit(OpCodes.Ret)

oMethodBuilder = oTypeBuilder.DefineMethod("GetStandardValues", MethodAttributes.Public, GetType(StandardValuesCollection), New Type() {GetType(ITypeDescriptorContext)})
oILGenerator = oMethodBuilder.GetILGenerator
oParams = New Type() {GetType(String)}
oConstructorInfo = GetType(StandardValuesCollection).GetConstructor(oParams)
oILGenerator.Emit(OpCodes.Ldarg_0, oConstructorInfo)
oILGenerator.Emit(OpCodes.Ret)

oMethodBuilder = oTypeBuilder.DefineMethod("GetStandardValuesExclusive", MethodAttributes.Public, GetType(Boolean), New Type() {GetType(ITypeDescriptorContext)})
oILGenerator = oMethodBuilder.GetILGenerator
oILGenerator.Emit(OpCodes.Ldarg_0, CType(True, Object))
oILGenerator.Emit(OpCodes.Ret)

Return oTypeBuilder.CreateType
Catch ex As Exception
Throw ex
End Try
End Function

AnswerRe: How to Create typeconverter dynamically by reflection to use in a PropertyGrid? Pin
J4amieC12-Feb-06 23:28
J4amieC12-Feb-06 23:28 
GeneralRe: How to Create typeconverter dynamically by reflection to use in a PropertyGrid? Pin
Mohamed Ali Jinnah13-Feb-06 0:05
Mohamed Ali Jinnah13-Feb-06 0:05 
GeneralRe: How to Create typeconverter dynamically by reflection to use in a PropertyGrid? Pin
Danilo Corallo10-Apr-06 3:09
Danilo Corallo10-Apr-06 3:09 
QuestionRegarding datagrid control (very urgent) Pin
nagalakshmibasireddy12-Feb-06 21:21
nagalakshmibasireddy12-Feb-06 21:21 
Questionremote connection error! Pin
pandapatin12-Feb-06 20:19
pandapatin12-Feb-06 20:19 
AnswerRe: remote connection error! Pin
Dave Kreskowiak14-Feb-06 8:03
mveDave Kreskowiak14-Feb-06 8:03 
Questionencountring a substring from a string inputted in a textbox Pin
anurag11oct12-Feb-06 18:49
anurag11oct12-Feb-06 18:49 
AnswerRe: encountring a substring from a string inputted in a textbox Pin
Colin Angus Mackay12-Feb-06 20:28
Colin Angus Mackay12-Feb-06 20:28 
QuestionHow to make a Web Browser based on these criterias? Pin
Iftikhar Ali12-Feb-06 17:38
Iftikhar Ali12-Feb-06 17:38 
AnswerRe: How to make a Web Browser based on these criterias? Pin
Dave Kreskowiak13-Feb-06 5:56
mveDave Kreskowiak13-Feb-06 5:56 
AnswerRe: How to make a Web Browser based on these criterias? Pin
Iftikhar Ali13-Feb-06 19:55
Iftikhar Ali13-Feb-06 19:55 
QuestionProblem migrating from VB to VB.NET Pin
drexler_kk12-Feb-06 17:38
drexler_kk12-Feb-06 17:38 
AnswerRe: Problem migrating from VB to VB.NET Pin
Dave Kreskowiak13-Feb-06 5:46
mveDave Kreskowiak13-Feb-06 5:46 
GeneralRe: Problem migrating from VB to VB.NET Pin
drexler_kk13-Feb-06 16:33
drexler_kk13-Feb-06 16:33 
QuestionNeed to print a single record from the data report Pin
Santhosh Nickson12-Feb-06 16:25
Santhosh Nickson12-Feb-06 16:25 
Questionprogramming for communications in VB6 using USB port Pin
wtfskh12-Feb-06 16:16
wtfskh12-Feb-06 16:16 
AnswerRe: programming for communications in VB6 using USB port Pin
Dave Kreskowiak13-Feb-06 5:38
mveDave Kreskowiak13-Feb-06 5:38 

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.