MessageBox.Show() Not showing text in popup box nor in button

ZorroRojo

Member
Joined
Oct 9, 2006
Messages
15
Location
Virginia, US
Programming Experience
Beginner
This is my first post here and I am hoping I have posted in the right place.

I know almost nothing about VB.NET but am trying to test some code I developed based off of examples I found. The code is supposed to give me all the file names and create dates for the files in a specific directory. I know the code works for giving me the correct file names (because I have tested it in a Sripting Task in an SSIS package for SQL Server 2005) but when I put it in VB.NET (with a few minor adjustments) I can't see any of the file names nor create dates because the pop up box is blank. I can't even see the words OK on the button.

All I did was create a new project in Visual Studio .NET 2003 and pasted the code into the form that was there. Here is the code I am using:

VB.NET:
Imports System
Imports System.Data
Imports System.Math
Imports System.IO
 
Public Class Form1
Inherits System.Windows.Forms.Form
 
#Region " Windows Form Designer generated code "
 
Public Sub New()
MyBase.New()
 
'This call is required by the Windows Form Designer.
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
 
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer. 
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(512, 190)
Me.Name = "Form1"
Me.Text = "Why"
 
End Sub
 
#End Region
 
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
FileNames(New DirectoryInfo("c:\Imports\LionShares"))
 
End Sub
 
Sub FileNames(ByVal dir As DirectoryInfo)
 
MessageBox.Show("Hello", "test", MessageBoxButtons.YesNo)
 
Dim objFile As FileInfo
 
For Each objFile In dir.GetFiles("*.txt")
MessageBox.Show(objFile.FullName & " " & objFile.CreationTime)
Next
 
objFile = Nothing
End Sub
End Class
After putting the code in I selected Build and then selected the form name. After that I went to Debug and selected Start. A blank pop up comes up for each file that is there. How do I get the file name to appear in the pop up and the OK or Yes/No to show up in the buttons?
 
Last edited by a moderator:
When you start app for debugging and go back to Visual Studio to look there are windows below the code, the tabs are named 'Locals' 'Immediate' and 'Output' etc. If they are not there you can activate them from main menu 'Debug' > 'Windows' >
 
I see Output which is where I have been seeing the output from the Console.WriteLine command. I also see tabs labeled Task List, Index Result, and Command Window (which I activated the way you said) when I click on that tab then I see Command Window - Immediate. The only other one for me to activate which I just did was Breakpoints. Is one of these what is referred to as locals?
 
Back
Top