I have an application in WPF The application closes periodically in client computer, in development it never happens. The following is the error in the windows event viewer
Fault bucket , type 0
Event Name: CLR20r3
Response: No disponible
Cab Id: 0
Problem signature:
P1: App.exe
P2: 1.0.0.0
P3: d2b32ca9
P4: mscorlib
P5: 4.7.3416.0
P6: 5cabfaa3
P7: 3ae2
P8: 0
P9: System.AccessViolationException
P10:
Any ideas, this error doesn't happen every day
Thanks
UPDATE
More info from event log Source .Net Runtime
Versión de Framework: v4.0.30319
Descripción: el proceso terminó debido a una excepción no controlada.
Información de la excepción: System.AccessViolationException
en System.Collections.Hashtable.GetHash(System.Object)
en System.Collections.Hashtable.InitHash(System.Object, Int32, UInt32 ByRef, UInt32 ByRef)
en System.Collections.Hashtable.ContainsKey(System.Object)
en System.Windows.Automation.Peers.AutomationPeer.UpdateChildrenInternal(Int32)
en System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
en System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
en System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
en System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
en System.Windows.ContextLayoutManager.fireAutomationEvents()
en System.Windows.ContextLayoutManager.UpdateLayout()
en System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object)
en System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
en System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object)
en System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(System.Object)
en System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
en System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
en System.Windows.Threading.DispatcherOperation.InvokeImpl()
en MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
en System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
en System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
en System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
en MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
en System.Windows.Threading.DispatcherOperation.Invoke()
en System.Windows.Threading.Dispatcher.ProcessQueue()
en System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
en MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
en MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
en System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
en System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
en System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
en MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
en MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
en System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
en System.Windows.Application.RunDispatcher(System.Object)
en System.Windows.Application.RunInternal(System.Windows.Window)
en MyApp.App.Main()
Related
Having a form with:
Me.AllowTransparency = True
Me.BackColor = Color.Magenta
Me.TransparencyKey = Me.BackColor
And doing:
SendMessage(pForm.Handle, WM_SETREDRAW, New IntPtr(CInt(False)), IntPtr.Zero)
Hides the form, without the transparency effect, works fine…
Is there a workaround? Another way to really suspend layout?
Definitions:
Private Const WM_SETREDRAW As Int32 = &HB
Private Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
Using Win10 (1803).
When I try to import a obj 3D object in Blend for Visual Studio 2012 it fail with this message:
Application: Blend.exe
Frameworkversion: v4.0.30319
Description: The process exited caused by an unhandled exception
Exceptioninformationen: System.ArgumentException
Stack:
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.Combine(String path1, String path2)
at Microsoft.Expression.DesignSurface.ViewModel.WavefrontObjDocumentElementCreator.WavefrontObjLoader.LoadObjFile(StreamReader streamReader, String rootPath, String filename)
at Microsoft.Expression.DesignSurface.ViewModel.WavefrontObjDocumentElementCreator.CreateElement(SceneViewModel viewModel, ISceneInsertionPoint insertionPoint, String url)
at Microsoft.Expression.DesignSurface.ViewModel.DocumentElementCreator.CreateInstance(ISceneInsertionPoint insertionPoint, Rect rect)
at Microsoft.Expression.DesignSurface.Tools.FileDropToolBehavior.AddToDocument(DocumentReference documentReference, Point dropPoint, ISceneInsertionPoint insertionPoint)
at Microsoft.Expression.DesignSurface.Tools.FileDropToolBehavior.OnDrop(DragEventArgs args)
at Microsoft.Expression.DesignSurface.Tools.EventRouter.ScopeElement_Drop(Object sender, DragEventArgs args)
at System.Windows.DragEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.OleDropTarget.RaiseDragEvent(RoutedEvent dragEvent, Int32 dragDropKeyStates, Int32& effects, DependencyObject target, Point targetPoint)
at System.Windows.OleDropTarget.MS.Win32.UnsafeNativeMethods.IOleDropTarget.OleDrop(Object data, Int32 dragDropKeyStates, Int64 point, Int32& effects)
at MS.Win32.UnsafeNativeMethods.DoDragDrop(System.Runtime.InteropServices.ComTypes.IDataObject, IOleDropSource, Int32, Int32[])
at System.Windows.OleServicesContext.OleDoDragDrop(System.Runtime.InteropServices.ComTypes.IDataObject, IOleDropSource, Int32, Int32[])
at System.Windows.DragDrop.OleDoDragDrop(System.Windows.DependencyObject, System.Windows.DataObject, System.Windows.DragDropEffects)
at System.Windows.DragDrop.DoDragDrop(System.Windows.DependencyObject, System.Object, System.Windows.DragDropEffects)
at Microsoft.Expression.Project.UserInterface.SourceItemNode.OnDragBegin(Microsoft.Expression.Utility.Controls.DragBeginEventArgs)
at Microsoft.Expression.Utility.Controls.DragBeginHelper.TryBeginDragDrop(System.Windows.Point, System.Windows.UIElement)
at Microsoft.Expression.Utility.Controls.DragBeginHelper.DragSourceControl_MouseMove(System.Object, System.Windows.Input.MouseEventArgs)
at System.Windows.Input.MouseEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run(System.Windows.Window)
at System.Windows.Application.Run()
at Microsoft.Expression.Framework.ExpressionApplication.RunApplication()
at Microsoft.Expression.Blend.BlendApplication.Start()
at Microsoft.Expression.Application.Main(System.String[])
Here u can download the project: http://sdrv.ms/1463KFl
http://www.codeproject.com/Articles/603954/Inserting-3D-Models-in-Expression-Blend
This is the solution for me :)
I have created a system and im new to vb.net. It is working fine. The problem is, I need to restrict the main page from 1.) Users and 2.) Admin.
For example, After logging in, Admin will proceed to the main page
And if users logs in, they will be directed to a different page
I'm still new to vb.net (like 6 weeks ago) and i am using microsoft access as my database. A lot of code I find online is very complex and technical. I just need simple vb.net code
Any help will be appreciated, thank you!!
i have posted my code for my login form, so you guys can further understand my coding:
Public Class Form1
Dim loginerror As String
Public Function login()
Dim DBconn As New ADODB.Connection
Dim user As New ADODB.Recordset
Dim Username As String
Dim userDB As String
Dim passDB As String
Dim UserFound As Boolean
DBconn.Open("Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = '" & Application.StartupPath & "\LoginDB.mdb'")
user.Open("UserTable", DBconn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
UserFound = False
login = False
Username = "Username = '" & txtuser.Text & "'" '
Do
user.Find(Username)
If user.BOF = False And user.EOF = False Then
userDB = user.Fields("Username").Value.ToString
passDB = user.Fields("Password").Value.ToString
If userDB <> txtuser.Text Then
user.MoveNext()
Else
UserFound = True
If passDB = txtpass.Text Then
user.Close()
DBconn.Close()
Return True
Else
loginerror = "Invalid Password"
user.Close()
DBconn.Close()
Return False
End If
End If
Else
loginerror = "Invalid Username"
user.Close()
DBconn.Close()
Return False
End If
Loop Until UserFound = True
user.Close()
DBconn.Close()
Return False
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If login() = True Then
Welcome.Show()
Me.Close()
Else
MessageBox.Show(loginerror, "Login Message")
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AcceptButton = Button1
Me.Show()
Application.DoEvents()
txtuser.Focus()
End Sub
Private Sub txtpass_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtpass.TextChanged
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
End Sub
Private Sub txtuser_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtuser.TextChanged
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
End Sub
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
End Sub
End Class
Just in case here is my coding for my main form:
Public Class Mainform
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Select MessageBox.Show("Are you sure you want to exit?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
Case Windows.Forms.DialogResult.Yes
Case Windows.Forms.DialogResult.No
e.Cancel = True
End Select
End Sub
Private Sub Mainform_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.WorkTableAdapter.Fill(Me.LoginDBDataSet.Work)
Me.AssetTableAdapter.Fill(Me.LoginDBDataSet.Asset)
Me.HistoryTableAdapter.Fill(Me.LoginDBDataSet.History)
Me.InventoryTableAdapter.Fill(Me.LoginDBDataSet.Inventory)
Me.Equipment1TableAdapter.Fill(Me.LoginDBDataSet.Equipment1)
End Sub
Private Sub mainform_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Escape Then Me.Close()
End Sub
Private Sub Equipment1BindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Equipment1BindingNavigatorSaveItem.Click
Me.Validate()
Me.Equipment1BindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.LoginDBDataSet)
End Sub
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Mainform_Load(Me, New System.EventArgs)
End Sub
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
Form1.Show()
Me.Dispose()
Me.Close()
End Sub
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
End Sub
Private Sub IDLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub TabPage5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage5.Click
End Sub
Private Sub Equipment_NameTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub HistoryDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
End Sub
Private Sub InventoryDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
End Sub
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
End Sub
Private Sub Machine_IDTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub _WO_CompletedLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub _WO_CompletedCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub _WO_CompletedCheckBox_CheckedChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Machine_IDTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Machine_IDTextBox1.TextChanged
End Sub
Private Sub _WO_CompletedCheckBox_CheckedChanged_2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _WO_CompletedCheckBox.CheckedChanged
End Sub
End Class
you need to determine if the user is administrator or not (usually your user table should have a role attached to the user e.g. administration, employee, etc.)
something like this when you try to log in
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If login() = True and UserRole='Administrator' Then
Welcome.Show()
Me.Close()
elseif login() = True then
WelcomeUser.Show()
Me.Close()
Else
MessageBox.Show(loginerror, "Login Message")
End If
End Sub
How to Read each row values from datagrid in Silverlight ?
i have this error
System.NullReferenceException was unhandled by user code
Message=La référence d'objet n'est pas définie à une instance d'un objet.
StackTrace:
à BusinessApplication4.Home.button4_Click(Object sender, RoutedEventArgs e)
à System.Windows.Controls.Primitives.ButtonBase.OnClick()
à System.Windows.Controls.Button.OnClick()
à System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
à System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
à MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
InnerException:
foreach (var dgcol in dataGrid2.ItemsSource)
This happens because you didn't specify an ItemsSource. Try iterating through the Items instead.
i'm hosting IronPython Scripts in one Silverlight Application and i want to run the script and get one System.Windows.Controls.TextBlock object.
so i use this ironPython code:
import clr
clr.AddReferenceByName("System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
from System.Windows.Controls import *
tb = TextBlock()
i'm being able to add the reference, but, when i import System.Windows.Controls i get a System.NotImplementedException.
The same happens if i try with "import wpf"
i'm using Silverlight 4 and IronPython 2.7.1 beta2
and this is the code to run the script:
Dim engine = IronPython.Hosting.Python.CreateEngine
Dim scope = engine.CreateScope()
Dim source = engine.CreateScriptSourceFromString(CodeTB.Text)
source.Execute(scope)
ResultLB.Items.Add(scope.GetVariable("hello"))
If scope.ContainsVariable("tb") Then
GuiStack.Children.Add(scope.GetVariable("tb"))
End If
Here is the Stack Trace of the exception:
en Microsoft.Scripting.PlatformAdaptationLayer.FileExists(String path)
en IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext context, String name, String path)
en IronPython.Runtime.Importer.LoadPackageFromSource(CodeContext context, String name, String path)
en IronPython.Runtime.Importer.LoadFromDisk(CodeContext context, String name, String fullName, String str)
en IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, List path, Func`5 defaultLoader)
en IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, List path)
en IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name)
en IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
en IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level)
en Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)
en Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
en Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
en IronPython.Runtime.Importer.ImportLightThrow(CodeContext context, String fullName, PythonTuple from, Int32 level)
en IronPython.Runtime.Importer.Import(CodeContext context, String fullName, PythonTuple from, Int32 level)
en IronPython.Runtime.Operations.PythonOps.ImportStar(CodeContext context, String fullName, Int32 level)
en Microsoft.Scripting.Interpreter.ActionCallInstruction`3.Run(InterpretedFrame frame)
en Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
en Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
en IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
en IronPython.Compiler.PythonScriptCode.Run(Scope scope)
en IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
en IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
en Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)
en Microsoft.Scripting.SourceUnit.Execute(Scope scope)
en Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
en TestApp2.MainPage.ExecuteButton_Click(Object sender, RoutedEventArgs e)
en System.Windows.Controls.Primitives.ButtonBase.OnClick()
en System.Windows.Controls.Button.OnClick()
en System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
en System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
en MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
And here is the all the source code
Thankyou for everything :)
It should work without any AddReference:
import clr
from System.Windows.Controls import TextBlock
tb = TextBlock()
Thank You, Lukas, the article was very helpful, now the problem is fixed.
Here's my new source code
Dim setup As ScriptRuntimeSetup = Python.CreateRuntimeSetup(Nothing)
setup.HostType = GetType(Microsoft.Scripting.Silverlight.BrowserScriptHost)
Dim runtime As New ScriptRuntime(setup)
Dim engine = IronPython.Hosting.Python.GetEngine(runtime)
Dim scope = engine.CreateScope()
Dim uri As New Uri("System.Windows.Controls.dll", UriKind.Relative)
Dim sri As StreamResourceInfo = Application.GetResourceStream(uri)
Dim ap As New AssemblyPart
Dim asm As Assembly = ap.Load(sri.Stream)
runtime.LoadAssembly(asm)
Dim assamblies As String() = {"mscorlib", "System", "System.Windows", "System.Windows.Browser", "System.Net"}
For Each item In assamblies
runtime.LoadAssembly(runtime.Host.PlatformAdaptationLayer.LoadAssembly(item))
Next
Dim source = engine.CreateScriptSourceFromString(CodeTB.Text, Microsoft.Scripting.SourceCodeKind.Statements)
source.Execute(scope)
ResultLB.Items.Add(scope.GetVariable("hello"))
If scope.ContainsVariable("tb") Then
GuiStack.Children.Add(scope.GetVariable("tb"))
End If