Click here to Skip to main content
15,913,453 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: PLEASE HELP!!! VB Database Connection Pin
ensuvari1-Mar-06 2:37
ensuvari1-Mar-06 2:37 
QuestionTreeview problem in vb.net Pin
pankajgarg1228-Feb-06 3:09
pankajgarg1228-Feb-06 3:09 
Questiondatagrid and vertical gridlines Pin
JerryMcguire28-Feb-06 1:28
JerryMcguire28-Feb-06 1:28 
AnswerRe: datagrid and vertical gridlines Pin
JerryMcguire28-Feb-06 1:57
JerryMcguire28-Feb-06 1:57 
QuestionSNA Server Pin
illusionFinder28-Feb-06 1:03
illusionFinder28-Feb-06 1:03 
QuestionData Binding property in vb.net Pin
pankajgarg1228-Feb-06 0:55
pankajgarg1228-Feb-06 0:55 
QuestionDatabase Problems in vb.net Pin
pankajgarg1228-Feb-06 0:40
pankajgarg1228-Feb-06 0:40 
QuestionHow to create a class inherited from StringConverter by Reflection.Emit (Dynamically) Pin
Mohamed Ali Jinnah27-Feb-06 22:58
Mohamed Ali Jinnah27-Feb-06 22:58 
Hi all,
Please can you help me on this. I want to create a class dynamically which is inherited from StringConverter with help of Reflection.Emit.

Class
---------------------------------
Public Class EngStatusConverter
Inherits StringConverter

Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As ITypeDescriptorContext) As Boolean
Return True
End Function

Public Overloads Overrides Function GetStandardValues(ByVal context As ITypeDescriptorContext) As StandardValuesCollection
Return New StandardValuesCollection(New String() {"RUNNING", "IDLE"})
'Return New StandardValuesCollection(sStdValues)
End Function

Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As ITypeDescriptorContext) As Boolean
Return True
End Function

End Class

Using Reflection.Emit
----------------------------
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


But this is not working. Can you help me on this.

Questionto invoke word,excel.... in vb.net Pin
thepityone27-Feb-06 22:32
thepityone27-Feb-06 22:32 
AnswerRe: to invoke word,excel.... in vb.net Pin
Member 22716551-Mar-06 22:23
Member 22716551-Mar-06 22:23 
QuestionRe: stoping winform instance - timer with synlock Pin
blucas200527-Feb-06 22:10
blucas200527-Feb-06 22:10 
QuestionCrystal Report Like Statment Pin
microuser_200027-Feb-06 21:33
microuser_200027-Feb-06 21:33 
AnswerRe: Crystal Report Like Statment Pin
darkelv28-Feb-06 3:41
darkelv28-Feb-06 3:41 
QuestionIssue with XML file Pin
mayhem_rules27-Feb-06 19:10
mayhem_rules27-Feb-06 19:10 
AnswerRe: Issue with XML file Pin
Christian Graus27-Feb-06 19:39
protectorChristian Graus27-Feb-06 19:39 
GeneralRe: Issue with XML file Pin
mayhem_rules27-Feb-06 20:19
mayhem_rules27-Feb-06 20:19 
GeneralRe: Issue with XML file Pin
Christian Graus28-Feb-06 11:01
protectorChristian Graus28-Feb-06 11:01 
AnswerRe: Issue with XML file Pin
Steve Pullan28-Feb-06 11:13
Steve Pullan28-Feb-06 11:13 
GeneralRe: Issue with XML file Pin
mayhem_rules28-Feb-06 18:13
mayhem_rules28-Feb-06 18:13 
GeneralRe: Issue with XML file Pin
Steve Pullan28-Feb-06 18:56
Steve Pullan28-Feb-06 18:56 
GeneralRe: Issue with XML file Pin
mayhem_rules28-Feb-06 22:02
mayhem_rules28-Feb-06 22:02 
GeneralRe: Issue with XML file Pin
Steve Pullan1-Mar-06 12:50
Steve Pullan1-Mar-06 12:50 
QuestionRemote Shutdown Pin
chrysler_vergara_m27-Feb-06 18:51
chrysler_vergara_m27-Feb-06 18:51 
AnswerRe: Remote Shutdown Pin
illusionFinder28-Feb-06 1:53
illusionFinder28-Feb-06 1:53 
QuestionWeb Connection Blocked Pin
huckeuri27-Feb-06 18:45
huckeuri27-Feb-06 18:45 

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.