Sep 27th, 2005, 12:53 PM
#1
Thread Starter
Fanatic Member
Class Variable Issue
Question 1:
Hi! I have an application that loads tons of picture into a listview. While it'S loading, the images loaded in the listview tend to appears and disappears. I would like to know if there is anyway I can "Freeze" the window while the images load, then refresh it... so the user wouldn't see that "bug". It would also allow the user to do anything until it's loaded, to avoid memory crashes... Thank You!
_________________________________________________________________
Question 2:
My Application has to be French and English. So I thought I was going to load the table corresponding to the language selected and store the language string into String variable, like:
VB Code:
Public MENU_ABOUT As String = CStr(datarow(0)) ' which is "About..."
Public MENU_ALWAYS_ON_TOP As String = CStr(datarow(1)) ' which is "Always on Top"
...
And I assign the Vakue to the component at runtime...
VB Code:
'
'mnuFile
'
Me.mnuFile.Enabled = CType(resources.GetObject("mnuFile.Enabled"), Boolean)
Me.mnuFile.Index = 0
Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuNewCollection, Me.mnuProperties, Me.mnuPrint, Me.mnuPrintSetup, Me.MenuItem13, Me.mnuImportFiles, Me.MenuItem14, Me.mnuMainExit})
Me.mnuFile.Shortcut = CType(resources.GetObject("mnuFile.Shortcut"), System.Windows.Forms.Shortcut)
Me.mnuFile.ShowShortcut = CType(resources.GetObject("mnuFile.ShowShortcut"), Boolean)
Me.mnuFile.Text = [B]MENU_FILE[/B]
Me.mnuFile.Visible = CType(resources.GetObject("mnuFile.Visible"), Boolean)
But I get Warning (it's not error because I still can run the application). I atached a screenshot. Why do I have all this saying "The variable is either undeclared or was never assigned" when THEY ACTUALLY ARE DECLARED AND ASSIGNED in module called LANG.
Thank You!
Attached Images
Last edited by jcavard; Oct 3rd, 2005 at 01:48 PM .
Sep 27th, 2005, 01:49 PM
#2
Fanatic Member
Re: <TWO IN ONE> "Freezing" Form AND Public Variable Issue
I think its a problem of scope. I think you should declare your constants as Shared variables in a module and refer to them by prefixing the modulename. i.e
VB Code:
Public Class Globals
public Shared MENU_FILE As String
public Shared MENU_BLABLA As String
Public Shared SetLanguage()
If French Then
' assign texts here
MENU_FILE = "Fichier"
Else
End If
End Sub
End Class
Then in the normal code use
VB Code:
Me.mnuFile.Text = Globals.MENU_FILE
Using VB.NET 2003/.NET 1.1/C# 2.0
http://del.icio.us/rajoo
Blow your mind, smoke gunpowder
Ashes to ashes, dust to dust
If God won't have you, the devil will. - Author unknown
Don't follow me, I'm lost too ...
Sep 27th, 2005, 02:07 PM
#3
Thread Starter
Fanatic Member
Re: <TWO IN ONE> "Freezing" Form AND Public Variable Issue
I made a class, with the var members and the initiating sub, but I still get the same Warning.
VB Code:
Public Class Lang
' STATUS BAR MESSAGE
Public Shared STATUS_VIEWING_COLLECTION As String
Public Shared STATUS_VIEWING_COLLECTION_NONE As String
Public Shared STATUS_VIEWING_IMAGE_OF_NONE As String
Public Shared STATUS_VIEWING_IMAGE_OF As String
' MSGBOX STRING
Public Shared MSGBOX_REGKEY As String
Public Shared MSGBOX_REGKEY_SUCCESSFUL As String
Public Shared MSGBOX_ERROR As String
Public Shared MSGBOX_ERROR_BLANK_LABEL As String
Public Shared MSGBOX_ERROR_WRONG_LABEL As String
Public Shared MENU_ABOUT As String
Public Shared MENU_ALWAYS_ON_TOP As String
Public Shared MENU_COPY As String
Public Shared MENU_CUT As String
Public Shared MENU_DELETE_IMAGE As String
Public Shared MENU_DSD_WEB As String
Public Shared MENU_EDIT As String
Public Shared MENU_EXIT As String
Public Shared MENU_FILE As String
Public Shared MENU_FIND As String
Public Shared MENU_HELP As String
Public Shared MENU_HELP_TOPIC As String
Public Shared MENU_IMPORT_FILES As String
Public Shared MENU_NEW_COLLECTION As String
Public Shared MENU_OPTIONS As String
Public Shared MENU_PASTE As String
Public Shared MENU_PRINT As String
Public Shared MENU_PRINTER_SETUP As String
Public Shared MENU_PROPERTIES As String
Public Shared MENU_README_FILE As String
Public Shared MENU_STATUS_BAR As String
Public Shared MENU_TOOLBAR As String
Public Shared MENU_TOOLS As String
Public Shared MENU_VIEW As String
Public Shared Sub setLang()
STATUS_VIEWING_COLLECTION = "Viewing subject: "
STATUS_VIEWING_COLLECTION_NONE = "Viewing subject: <none>"
STATUS_VIEWING_IMAGE_OF_NONE = "Image X of Y"
STATUS_VIEWING_IMAGE_OF = "Image {0} of {1}"
MSGBOX_REGKEY = "Registry"
MSGBOX_REGKEY_SUCCESSFUL = "Registry edited successfully"
MSGBOX_ERROR = "Error"
MSGBOX_ERROR_BLANK_LABEL = "Invalid tree node label." + Microsoft.VisualBasic.ControlChars.Cr + "The label cannot be blank"
MSGBOX_ERROR_WRONG_LABEL = "Invalid tree node label." + Microsoft.VisualBasic.ControlChars.Cr + "The invalid characters are: '@','.', ',', '!'"
MENU_ABOUT = "About..."
MENU_ALWAYS_ON_TOP = "Always on Top"
MENU_COPY = "Copy"
MENU_CUT = "Cut"
MENU_DELETE_IMAGE = "Delete Image"
MENU_DSD_WEB = "DSD on the Web"
MENU_EDIT = "Edit"
MENU_EXIT = "Exit"
MENU_FILE = "File"
MENU_FIND = "Find"
MENU_HELP = "?"
MENU_HELP_TOPIC = "Help Topics"
MENU_IMPORT_FILES = "Import Files..."
MENU_NEW_COLLECTION = "New Collections"
MENU_OPTIONS = "Options..."
MENU_PASTE = "Paste"
MENU_PRINT = "Print..."
MENU_PRINTER_SETUP = "Printer Setup..."
MENU_PROPERTIES = "Properties"
MENU_README_FILE = "'ReadMe' File"
MENU_STATUS_BAR = "Status Bar"
MENU_TOOLBAR = "Toolbar"
MENU_TOOLS = "Tools"
MENU_VIEW = "View"
End Sub
End Class
and this to set the var
VB Code:
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
[B]Lang.setLang()[/B]
'Ajoutez une initialisation quelconque après l'appel InitializeComponent()
End Sub
'mnuFile
'
Me.mnuFile.Enabled = CType(resources.GetObject("mnuFile.Enabled"), Boolean)
Me.mnuFile.Index = 0
Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuNewCollection, Me.mnuProperties, Me.mnuPrint, Me.mnuPrintSetup, Me.MenuItem13, Me.mnuImportFiles, Me.MenuItem14, Me.mnuMainExit})
Me.mnuFile.Shortcut = CType(resources.GetObject("mnuFile.Shortcut"), System.Windows.Forms.Shortcut)
Me.mnuFile.ShowShortcut = CType(resources.GetObject("mnuFile.ShowShortcut"), Boolean)
Me.mnuFile.Text = Lang.MENU_FILE 'resources.GetString("mnuFile.Text")
Me.mnuFile.Visible = CType(resources.GetObject("mnuFile.Visible"), Boolean)
Last edited by jcavard; Sep 27th, 2005 at 02:10 PM .
Sep 27th, 2005, 03:29 PM
#4
Re: <TWO IN ONE> "Freezing" Form AND Public Variable Issue
You could do this.
VB Code:
Me.ListView1.BeginUpdate()
'Do stuff
Me.ListView1.EndUpdate()
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Sep 27th, 2005, 03:44 PM
#5
Thread Starter
Fanatic Member
Re: <TWO IN ONE> "Freezing" Form AND Public Variable Issue
Sep 27th, 2005, 03:47 PM
#6
Re: <TWO IN ONE> "Freezing" Form AND Public Variable Issue
What if you change the order in which its called?
VB Code:
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
Lang.setLang()
InitializeComponent()
'Ajoutez une initialisation quelconque après l'appel InitializeComponent()
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Sep 28th, 2005, 08:30 AM
#7
Thread Starter
Fanatic Member
Re: <TWO IN ONE> "Freezing" Form AND Public Variable Issue
same thing... I get an error saying Lang.MENU_FILE is not declared ...
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width