|
-
May 4th, 2004, 11:56 PM
#1
Thread Starter
Addicted Member
How do i clear the screen?
I am making a windows app i have 1 form i want to clear it. I searched the forums, i googled around, and i still have no idea. Oh ya visual studio.net has the best help ive ever seen in any software package. Those microsoft guys are clever bunch. The help is so worthless why even have it?
-
May 5th, 2004, 01:17 AM
#2
what do you mean by clearing the screen? are you trying to clear up the stuff you've drawn on a windows form? you can just set it's image property to nothing and I guess that would clear it
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
May 5th, 2004, 03:59 AM
#3
PowerPoster
Hi,
"The help is so worthless why even have it?"
MSDN Help is brilliant - provided you know how to use it!!! You HAVE to know precisely what question you are asking. If you ask the wrong question, that is your fault, not Microsoft's.
Your question is a good example. As MrPolite implies, what you probably DON'T want to do is "Clear the Screen". (If you do actually want to clear the screen without closing the application then simply use the minimise button.)
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
May 5th, 2004, 04:42 PM
#4
New Member
If I do understand you correctly, you want to make all textboxes empty? If so, let me know, I may send you an example code, or explain it. It's not that hard. You just need create a "For each" statement and go through Controls collection of a form. Than determine type of a currently selected control and by using "Select Case" or "If End If" you will need create variable of the type of current control, assign that control to a variable and do what ever you want with that control.
-
May 5th, 2004, 04:54 PM
#5
PowerPoster
Hi,
"If I do understand you correctly, you want to make all textboxes empty?"
If that is what is wanted the most recent thread to cover it is;
http://www.vbforums.com/showthread.p...hreadid=288891
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
May 5th, 2004, 05:02 PM
#6
New Member
Sorry, 
haven't noticed that post while writting this one.
-
May 5th, 2004, 05:16 PM
#7
PowerPoster
Hi XD
"Sorry,
haven't noticed that post while writting this one."
Don't be sorry. You may have hit upon what the guy wants to do
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
May 6th, 2004, 07:13 AM
#8
Frenzied Member
Re: How do i clear the screen?
Originally posted by abcdefg
Oh ya visual studio.net has the best help ive ever seen in any software package. Those microsoft guys are clever bunch. The help is so worthless why even have it?
so...do you think it's good or do you not like it? you've contadicted yourself.
Basically, to get the form back to defaults(I assume that's what you mean), you have to write code that will go through each control (text boxes, listboxes, combo-boxes, etc) and either set the text to "" or in some cases you can call the emtpy() method or clear() method.
-
May 6th, 2004, 07:15 AM
#9
Frenzied Member
here are some really good routines I wrote (the guys in this forum helped me get these started way back when, what a great forum!!)
VB Code:
Public Sub ClearListBox(ByVal box As ListBox)
'Purpose : Clear a list box of all items
'Accepts : listbox control
box.Items.Clear()
End Sub
Public Sub ClearTabControl(ByVal tc As TabControl)
'Purpose : clears all tabpages on a tabpage control
'Accepts : control as tabcontrol
For Each Ctrl As Control In tc.Controls
Try
If TypeOf Ctrl Is TabPage Then
ClearTab(Ctrl)
End If
Catch ex As Exception
'Catch all errors
ErrorMessage(ex.Message)
End Try
Next
End Sub
Public Sub ClearTab(ByVal Tab As Control)
'Purpose : Clears an entire tab control of data
'Accepts : tabpage control
'Notes : this sub calls on other subs to do the work
For Each Ctrl As Control In Tab.Controls
Try
'Scan any tabConrols first
If TypeOf Ctrl Is TabControl Then
ClearTab(Ctrl)
End If
'Next, other Tabs
If TypeOf Ctrl Is TabPage Then
ClearTab(Ctrl)
End If
'Clear all textboxes
If TypeOf Ctrl Is TextBox Then
ClearTextBox(Ctrl)
End If
'Next, ComboBoxes
If TypeOf Ctrl Is ComboBox Then
ClearComboBox(Ctrl)
End If
'Next, Groupboxes
If TypeOf Ctrl Is GroupBox Then
ClearGroupBox(Ctrl)
End If
'Next, Listboxes
If TypeOf Ctrl Is ListBox Then
ClearListBox(Ctrl)
End If
Catch ex As Exception
'Catch all errors
ErrorMessage(ex.Message & Ctrl.Name)
End Try
Next
End Sub
Public Sub ClearComboBox(ByVal Box As ComboBox)
'Purpose : Resets a combobox to the first item in the collection list
'Accepts : combox as argument
'Notes : This doesn't delete any info, it just resets the box
Try
Box.Text = Box.Items.Item(0)
Catch ex As Exception
'Catch all errors
ErrorMessage(ex.Message & Box.Name)
End Try
End Sub
Public Sub ClearGroupBox(ByVal groupbox As GroupBox)
'Purpose : Clear all textboxes within a groupbox control
'Accepts : groupbox as argument
For Each ctrl As Control In groupbox.Controls
Try
If TypeOf ctrl Is TextBox Then
ClearTextBox(ctrl)
End If
If TypeOf ctrl Is ComboBox Then
ClearComboBox(ctrl)
End If
'If TypeOf ctrl Is ListBox Then
' ClearListBox(ctrl)
'End If
Catch ex As Exception
'Catch all errors
ErrorMessage(ex.Message)
End Try
Next
End Sub
Public Sub ClearTextBox(ByVal Box As TextBox)
Box.Text = String.Empty
End Sub
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
|