dcsimg
Results 1 to 4 of 4

Thread: Blank form when ran or debugging

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2019
    Posts
    11

    Blank form when ran or debugging

    Before running or debugging, I see this:
    Name:  yahtzpic.jpg
Views: 130
Size:  28.5 KB

    But when I debug, my form is blank:

    Name:  ran.jpg
Views: 135
Size:  8.1 KB

    What could cause this? I'm wondering if it has to do with initializing it? Here is a part of the code:
    ----------------------------------------------------------------------------------------------------------------------------
    Public Class YahtzeeForm
    Inherits System.Windows.Forms.Form
    Public Sub New()
    MyBase.New()
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    Friend WithEvents RightTotalLabel As System.Windows.Forms.Label
    Friend WithEvents GrandTotalLabel As System.Windows.Forms.Label
    Friend WithEvents LeftTotalLabel As System.Windows.Forms.Label
    Friend WithEvents LeftBonusLabel As System.Windows.Forms.Label
    Friend WithEvents YahtzeeLabel As System.Windows.Forms.Label

  2. #2
    Fanatic Member
    Join Date
    Nov 2017
    Posts
    837

    Re: Blank form when ran or debugging

    Is it possible your project has multiple forms, and that the startup form isn't the form you think it is, and is instead another form in your project that is completely blank?

  3. #3
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,478

    Re: Blank form when ran or debugging

    One possibility is if you have a Public Sub New in your code (not talking about the designer file shown) make sure it has InitializeComponent().

    Code:
    Public Sub New()
        InitializeComponent()
    End Sub

  4. #4
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    5,551

    Re: Blank form when ran or debugging

    Yeah, the image is rather blurry, but it doesn't look like what you're looking at in the IDE is Form1, but your startup form is probably Form1 so that is what you're seeing. Perhaps go to the project properties and change the startup form to whatever form you put all the controls on.
    It's actually called "Startup Object".

    Based on the code, I guess your startup form should be YahtzeeForm.
    Last edited by passel; Jun 10th, 2019 at 09:18 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width