I need to create a form from this web service
http://24.163.239.122/wsprojecttrack...erobjects.asmx
if you call getloginscreen there is a field called screendescripti on
that field screendescripti on has the form code I am trying to create at
runtime
the code that is in the field screendecriptio n is
Imports System.Windows. Forms
Public Class clsLoginScreen
Inherits System.Windows. Forms.Form
Public Sub New()
MyBase.New()
InitializeCompo nent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private components As System.Componen tModel.IContain er
Friend WithEvents NicePanel1 As PureComponents. NicePanel.NiceP anel
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Dim ContainerImage1 As PureComponents. NicePanel.Conta inerImage = New
PureComponents. NicePanel.Conta inerImage
Dim HeaderImage1 As PureComponents. NicePanel.Heade rImage = New
PureComponents. NicePanel.Heade rImage
Dim HeaderImage2 As PureComponents. NicePanel.Heade rImage = New
PureComponents. NicePanel.Heade rImage
Dim PanelStyle1 As PureComponents. NicePanel.Panel Style = New
PureComponents. NicePanel.Panel Style
Dim ContainerStyle1 As PureComponents. NicePanel.Conta inerStyle = New
PureComponents. NicePanel.Conta inerStyle
Dim PanelHeaderStyl e1 As PureComponents. NicePanel.Panel HeaderStyle = New
PureComponents. NicePanel.Panel HeaderStyle
Dim PanelHeaderStyl e2 As PureComponents. NicePanel.Panel HeaderStyle = New
PureComponents. NicePanel.Panel HeaderStyle
Me.NicePanel1 = New PureComponents. NicePanel.NiceP anel
Me.SuspendLayou t()
Me.NicePanel1.B ackColor = System.Drawing. Color.Transpare nt
ContainerImage1 .Alignment = System.Drawing. ContentAlignmen t.BottomRight
ContainerImage1 .ClipArt = PureComponents. NicePanel.Image ClipArt.None
ContainerImage1 .Image = Nothing
ContainerImage1 .Size = PureComponents. NicePanel.Conta inerImageSize.S mall
ContainerImage1 .Transparency = 50
Me.NicePanel1.C ontainerImage = ContainerImage1
HeaderImage1.Cl ipArt = PureComponents. NicePanel.Image ClipArt.None
HeaderImage1.Im age = Nothing
Me.NicePanel1.F ooterImage = HeaderImage1
Me.NicePanel1.F ooterText = "PureCompon ents NicePanel for .NET WinForms
V1.0."
Me.NicePanel1.F oreColor = System.Drawing. Color.Black
HeaderImage2.Cl ipArt =
PureComponents. NicePanel.Image ClipArt.PureCom ponents
HeaderImage2.Im age = Nothing
Me.NicePanel1.H eaderImage = HeaderImage2
Me.NicePanel1.H eaderText = "NicePanel1 "
Me.NicePanel1.I sExpanded = True
Me.NicePanel1.L ocation = New System.Drawing. Point(0, 0)
Me.NicePanel1.N ame = "NicePanel1 "
Me.NicePanel1.O riginalFooterVi sible = True
Me.NicePanel1.O riginalHeight = 0
Me.NicePanel1.S ize = New System.Drawing. Size(400, 264)
ContainerStyle1 .BackColor = System.Drawing. Color.FromArgb( CType(142,
Byte), CType(179, Byte), CType(231, Byte))
ContainerStyle1 .BaseColor = System.Drawing. Color.Transpare nt
ContainerStyle1 .BorderColor = System.Drawing. Color.FromArgb( CType(1,
Byte), CType(45, Byte), CType(150, Byte))
ContainerStyle1 .BorderStyle = PureComponents. NicePanel.Borde rStyle.Solid
ContainerStyle1 .CaptionAlign = PureComponents. NicePanel.Capti onAlign.Left
ContainerStyle1 .FadeColor = System.Drawing. Color.FromArgb( CType(217,
Byte), CType(232, Byte), CType(252, Byte))
ContainerStyle1 .FillStyle =
PureComponents. NicePanel.FillS tyle.DiagonalFo rward
ContainerStyle1 .FlashItemBackC olor = System.Drawing. Color.Red
ContainerStyle1 .FocusItemBackC olor =
System.Drawing. Color.FromArgb( CType(255, Byte), CType(255, Byte), CType(128,
Byte))
ContainerStyle1 .Font = New System.Drawing. Font("Microsoft Sans Serif",
8.25!, System.Drawing. FontStyle.Regul ar, System.Drawing. GraphicsUnit.Po int,
CType(0, Byte))
ContainerStyle1 .ForeColor = System.Drawing. Color.Black
ContainerStyle1 .Shape = PureComponents. NicePanel.Shape .Squared
PanelStyle1.Con tainerStyle = ContainerStyle1
PanelHeaderStyl e1.BackColor = System.Drawing. Color.FromArgb( CType(9,
Byte), CType(42, Byte), CType(127, Byte))
PanelHeaderStyl e1.ButtonColor = System.Drawing. Color.FromArgb( CType(172,
Byte), CType(191, Byte), CType(227, Byte))
PanelHeaderStyl e1.FadeColor = System.Drawing. Color.FromArgb( CType(102,
Byte), CType(145, Byte), CType(215, Byte))
PanelHeaderStyl e1.FillStyle =
PureComponents. NicePanel.FillS tyle.Horizontal Fading
PanelHeaderStyl e1.FlashBackCol or =
System.Drawing. Color.FromArgb( CType(243, Byte), CType(122, Byte), CType(1,
Byte))
PanelHeaderStyl e1.FlashFadeCol or =
System.Drawing. Color.FromArgb( CType(255, Byte), CType(215, Byte), CType(159,
Byte))
PanelHeaderStyl e1.FlashForeCol or = System.Drawing. Color.White
PanelHeaderStyl e1.Font = New System.Drawing. Font("Microsoft Sans Serif",
8.25!)
PanelHeaderStyl e1.ForeColor = System.Drawing. Color.FromArgb( CType(169,
Byte), CType(198, Byte), CType(237, Byte))
PanelHeaderStyl e1.Size = PureComponents. NicePanel.Panel HeaderSize.Smal l
PanelStyle1.Foo terStyle = PanelHeaderStyl e1
PanelHeaderStyl e2.BackColor = System.Drawing. Color.FromArgb( CType(102,
Byte), CType(145, Byte), CType(215, Byte))
PanelHeaderStyl e2.ButtonColor = System.Drawing. Color.FromArgb( CType(172,
Byte), CType(191, Byte), CType(227, Byte))
PanelHeaderStyl e2.FadeColor = System.Drawing. Color.FromArgb( CType(9,
Byte), CType(42, Byte), CType(127, Byte))
PanelHeaderStyl e2.FillStyle =
PureComponents. NicePanel.FillS tyle.VerticalFa ding
PanelHeaderStyl e2.FlashBackCol or =
System.Drawing. Color.FromArgb( CType(243, Byte), CType(122, Byte), CType(1,
Byte))
PanelHeaderStyl e2.FlashFadeCol or =
System.Drawing. Color.FromArgb( CType(255, Byte), CType(215, Byte), CType(159,
Byte))
PanelHeaderStyl e2.FlashForeCol or = System.Drawing. Color.White
PanelHeaderStyl e2.Font = New System.Drawing. Font("Microsoft Sans Serif",
9.75!, System.Drawing. FontStyle.Bold)
PanelHeaderStyl e2.ForeColor = System.Drawing. Color.FromArgb( CType(215,
Byte), CType(230, Byte), CType(251, Byte))
PanelHeaderStyl e2.Size = PureComponents. NicePanel.Panel HeaderSize.Medi um
PanelStyle1.Hea derStyle = PanelHeaderStyl e2
Me.NicePanel1.S tyle = PanelStyle1
Me.NicePanel1.T abIndex = 0
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(400, 273)
Me.Controls.Add (Me.NicePanel1)
Me.Name = "clsLoginScreen "
Me.Text = "clsLoginScreen "
Me.ResumeLayout (False)
End Sub
Private Sub clsLoginScreen_ Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
End Sub End Class
So that is the code that is being pulled out of the database
It is just a plain form with a nicepanel on it. Which intails need the
nicepanel assembly added.
Here is my code I am using to try to get the form to compile at run time
I make a direct call to the database rather then hitting the web service in
the code below.
Dim cn As OleDbConnection
Dim sConnString As String = _
"Provider=SQLOL EDB;server=vsde v;UID=sa;PWD=sa ;database=proje cttracker"
cn = New OleDb.OleDbConn ection(sConnStr ing)
Dim ds As New DataSet
Dim cm As New OleDbCommand("s elect * from tblscreen", cn)
Dim a As New OleDbDataAdapte r(cm)
cn.Open()
a.Fill(ds)
cn.Close()
Dim provider As Microsoft.Visua lBasic.VBCodePr ovider
Dim compiler As System.CodeDom. Compiler.ICodeC ompiler
Dim params As System.CodeDom. Compiler.Compil erParameters
Dim results As System.CodeDom. Compiler.Compil erResults
Dim scriptType As Type
Dim instance As Object
Dim rslt As Object
params = New System.CodeDom. Compiler.Compil erParameters
params.Generate InMemory = True 'Assembly is created in memory
params.TreatWar ningsAsErrors = False
params.WarningL evel = 4
'Put any references you need here - even you own dll's, if you want
to use one
Dim refs() As String = {"System.IO" , "System.dll ",
"Microsoft.Visu alBasic.dll", "PureComponents .NicePanel.Nice Panel",
"System.Windows .Forms"}
params.Referenc edAssemblies.Ad dRange(refs)
provider = New Microsoft.Visua lBasic.VBCodePr ovider
compiler = provider.Create Compiler
Try
results = compiler.Compil eAssemblyFromSo urce(params,
ds.Tables(0).Ro ws(0).Item("scr eendescription" ).ToString)
Catch ex As Exception
End Try
If results.Errors. Count = 0 Then 'No compile errors or
warnings...
mAssembly = results.Compile dAssembly
End If
'Get the type from the assembly. This will allow us access to
'all the properties and methods
Dim err As System.CodeDom. Compiler.Compil erError
For Each err In results.Errors
MsgBox(String.F ormat( _
"Line {0}, Col {1}: Error {2} - {3}", _
err.Line, err.Column, err.ErrorNumber , err.ErrorText))
Next
scriptType = mAssembly.GetTy pe("clsScreens. clsLoginScreen" )
'Set up an array of objects to pass as arguments.
Dim args() As Object = {""}
'And call the static function
rslt = scriptType.Invo keMember("Stati cFunction", _
System.Reflecti on.BindingFlags .InvokeMethod Or _
System.Reflecti on.BindingFlags .Public Or _
System.Reflecti on.BindingFlags .Static, _
Nothing, Nothing, args)
So as you can see I pull the form out of the database. It is a windows form.
But I think that I missing some stuff. When you create a form you get a .vb
file and a ..resx file which i am not createing the resx file.
I did not think that you needed to create that file.
If you have any thoughts please let me know
Thank you
CC