[Mono-bugs] [Bug 456326] New: TinyGecko.cs converting to TinyGecko.vb

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Dec 4 00:41:25 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=456326


           Summary: TinyGecko.cs converting to TinyGecko.vb
           Product: Mono: Compilers
           Version: 1.9
          Platform: i686
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Basic
        AssignedTo: rkvinge at novell.com
        ReportedBy: obrigman at nc.rr.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer


Tried to convert the TinyGecko.cs example for mono beginners to TinyGecko.vb
for mono-basic beginners!

Here is the code along with the error message:

'06-basic/TinyGecko2.vb
'08-intermediate/06-basic
'This works using "vbnc
/r:$MONODIR/usr/lib/mono/gtk-sharp-2.0/gtk-sharp.dll,$MONODIR/usr/lib/mono/gecko-sharp-2.0/gecko-sharp.dll
TinyGecko.vb"
'The only thing is if you click the "GO" button, a whole host of compilation
problems occur.
'Most look like this::
' "Exception in Gtk# callback delegate
'  Note: Applications can use GLib.ExceptionManager.UnhandledException to
handle the exception.
'  System.NullReferenceException: Object reference not set to an instance of an
object
'  at TinyGecko.GoButtonClicked (System.Object obj, System.EventArgs args)
[0x00000]
 ' at GLib.Signal.voidObjectCallback (IntPtr handle, IntPtr data) [0x00000]
'  at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean
is_terminal)
'  at GLib.Signal.voidObjectCallback(IntPtr handle, IntPtr data)
'  at GLib.Signal.voidObjectCallback(IntPtr , IntPtr )
'  at Gtk.Application.gtk_main()
'  at Gtk.Application.gtk_main()
'  at Gtk.Application.Run()
'  at TinyGecko.Main()

'I also had to re-DIM the Browser As WebControl in the Shared Sub because the
compilation
'could not resolve the name 'Browser'! Also when you click the "GO" button the
program disappears!

'Copy this code and see what you get
'To Compile use "vbnc
/r:$MONODIR/usr/lib/mono/gtk-sharp-2.0/gtk-sharp.dll,$MONODIR/usr/lib/mono/gecko-sharp-2.0/gecko-sharp.dll
TinyGecko.vb"
'Thanks to Roth for this compiler sequence
'Remember to use your own path to your mono directory!

Imports System
Imports Gtk
Imports Gecko

Class TinyGecko

    Shared Sub Main()
          Application.Init()
          Dim Win As Window 
          Dim GoButton As Button
          Dim StopButton As Button
          Dim entry1 As Entry
          Dim RefButton As Button
          Dim BckButton As Button
          Dim FwdButton As Button
          Dim Frame1 As Frame
          Dim Browser As WebControl
      'Dim URL As String
          Dim vsBox As VBox
          Dim hsBox As HBox

        'Application.Init()
          Win = New Window("TinyGecko")
          GoButton = New Button("GO")
          StopButton = New Button("STOP")
          entry1 = New Entry("Should enter a Url here")
          RefButton = New Button("Refresh")
          BckButton = New Button("Back")
          FwdButton = New Button("Foward")
          Frame1 = New Frame()
          Browser = New WebControl()
          hsBox = New HBox
          vsBox = New VBox
          vsBox.PackStart(hsBox, false, true, 1)
          hsBox.PackEnd(StopButton, false, false, 1)
          hsBox.PackEnd(GoButton, false, false, 1)
          hsBox.PackEnd(entry1, true, true, 1)
          hsBox.PackEnd(RefButton, false, false, 1)
          hsBox.PackEnd(BckButton, false, false, 1)
          hsBox.PackEnd(FwdButton, false, false, 1)
          Frame1.Add(Browser)
          vsBox.PackStart(Frame1, true, true, 1)
          Win.Add(vsBox)
          Win.SetDefaultSize(800, 600)
          Win.ShowAll()
          AddHandler Win.DeleteEvent, AddressOf WindowDelete
          AddHandler GoButton.Clicked, AddressOf GoButtonClicked
          AddHandler StopButton.Clicked, AddressOf StopButtonClicked
          Application.Run()
    End Sub

    Shared Sub WindowDelete(ByVal obj As Object, ByVal args As DeleteEventArgs) 
          Application.Quit()
    End Sub

    Shared Sub GoButtonClicked(ByVal obj As Object, ByVal args As EventArgs) 
          Dim Browser As WebControl
          Browser.LoadUrl(entry1.Text.Trim())
    End Sub

    Shared Sub StopButtonClicked(ByVal obj As Object, ByVal args As EventArgs) 
          Application.Quit()
    End Sub

End Class


"ERROR CODE IS AT THE TOP"


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list