|
hi all, i only want to get my scrollbars working. what i have done is paste 1 horizontal and 1 vertical bar on my form, put a button in the form but its out of view of the user(outside the form) and when i run the program i want it to be able to scroll to the place where i have placed my button. however it doesnt work, cause the button nv shows up. do i need to do any coding for this? thanks!!
|
|
|
|
|
|
Wait holdup I dont think so. If you are using vb .net standard winform one of the properties for the form is AutoScroll which by default is set to false if you set it to true it will Automatically put Scroll Bars on a form when they are necassary.
1. Out of clutter, find simplicity.
2. From discord, find harmony.
3. In the middle of difficulty lies opportunity.
Albert Einstein
three rules of work
|
|
|
|
|
Hi,
How can i add the "Right-to-Left" property to the ToolTip control? i've done this before for the ListView control by creating a new control that inherits from the original & adding the required parameters. The problem is that ToolTip control is marked "NonInheritable". Is there any way to support this feature??
thanx
|
|
|
|
|
if you have a text starting from right to left then it will automatically show you the right thing. As I have build one software with Arabic Support and it gives text from right to left. So what exactly is your problem.... ???
the control is visible false at runtime so what do you mean by right to left ?
|
|
|
|
|
Anonymous wrote:
if you have a text starting from right to left then it will automatically show you the right thing.
This is my problem!! i'm writing a SW with Arabic support, i have a tooltip text in arabic, but when the mouse hovers over the control, the tooltip text is shown from left to right is there a property i forgot to set or something???
|
|
|
|
|
Arabic Support means the tooltip is in Arabic and will come from right to left. Second thing is if this is coming from left to right then be sure that Arabic is Enabled on your or client machine. Go to Regional settings in control panel and add the right to left languages..
cheers...
|
|
|
|
|
I am using IDisposable interface and trying to dispose my class but that not working. Class variables still hold references to old values. How can i actually dispose off the class. I was of the view that by disposing off a class all the managed memory is freed up.
Public Overloads Sub Dispose() Implements System.IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
|
|
|
|
|
|
This is the way i am using the references
Public Class Class3
Private strH3 As String
Public Sub dispose()
GC.Collect()
End Sub
Public Property H3() As String
Get
Return strH3
End Get
Set(ByVal Value As String)
strH3 = Value
End Set
End Property
End Class
Public Class Class1
Dim c3 As Class3 = New Class3
Public Sub H3()
c3.H3 = "Class3 => Class1"
MsgBox(c3.H3)
c3.dispose()
End Sub
Public Sub dispose()
GC.Collect()
End Sub
End Class
Form_Load event of the application
Dim a As Class1 = New Class1
a.H3()
a.dispose()
GC.Collect()
a.H3()
Now when i call the c3.dispose in class1 then the reference to tclass3 should be removed and later when i call a3.dispose reference to a class1 will be destroyed. Second call to a.h3 works fine as well.
I have tried the finalize method as well but the result is same
now when i set a=nothing then it works fine but we know that nothing sets it to the default value. so if i have a constructor with some default values it will set it to that.
If i am wrong do correct it.
|
|
|
|
|
First, you should not be calling GC.Collect() - the garbage collector is optimised already so don't undo that optimisation by forcing a collect.
You don't appear to have any UNmanaged resources so the dispose method is pointless - it is for disposing of unmanged (non-.NET) resources. If you don't directly have any unmanaged resources in your class, but it is made up of object that have dispose methods, then your dispose method should call dispose on these objects. So, there are only 2 valid reasons for having a Dispose method. (1) Clear up unmanaged resources, (2) calling dispose on objects in the class.
nitin_ten wrote:
Now when i call the c3.dispose in class1 then the reference to tclass3 should be removed
No, as I've said already, that is not how it works. Dispose is only for clearing up unmanaged resources. It does NOT remove references.
nitin_ten wrote:
now when i set a=nothing then it works fine but we know that nothing sets it to the default value
No, that is not correct. If you set a reference to Nothing the reference does not point to anything. It does not create a default instance of the class; it does not initialise any values.
Does this help?
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
thanks for this, but my problem is still the same how do i destroy the object completely. Nothing won't work and dispose as u said won't work either and even though gc.collect should work but i want to refrain myself from using it and .net doesn't have 'deterministic finalization'. so what is the solution.
|
|
|
|
|
When you set all references to the object to Nothing it is effectively destroyed. While it does still reside in memory for a while, until the garbage collector gets it, it is no longer accessible because nothing refernces it.
If you have a reference to an object then the garbage collector cannot collect it because something is referencing it. If something is referencing it then it is not safe to remove it.
What you might consider looking into is the WeakReference[^] class. This allows you to hold a reference to an object that the garbage collector effectively ignores. So, if you remove all strong references (i.e. a normal reference) then the garbage collector will remove it when it gets round to it. The weak reference will then return Nothing.
Does this help?
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Thanx Colin. I first set all the reference of class3 in class1 to nothing and then set the reference of class1 to nothing and then called
GC.GetTotalMemory(True)
GC.Collect()
GC.GetTotalMemory(True)
the memory is freed up and the object is destroyed. The problem i found out in the application is that i am using collections and even though when i set the object of the class to nothing collection should also freeup the memory allocation. But that is what is not happening. I found out that on the click event of the button when i create a new object of the class, all the variable except the collection are re initialized to their default value. In case of collection they already have old values and are adding new values along with the old one. What is the problem.
|
|
|
|
|
Since I don't know anything about this collection I cannot really say. If the collection is a member variable on your form and you have not deleted the contents then of course the values will be retained so long as the form exists. The collection will be holding references to the objects, and since the object has a reference to it the garbage collector won't touch it.
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
I forgot to mention that collection is declared as shared and i did figured out that this is the problem. But i cannot declare collection as instance of the class. But i want to destroy the collection with the instance of the class. so i tried c.col =nothing (col is collection type property). But the next time i click on the button it gives object reference error whcih is understandable since shared are not instance specific. So the now the class is initialized but the shared collection is already set to nothing.
What should i do so that the collection is destroyed along with the instance of the class or is there a datatype that works like shared but is destroyed when the instance is destroyed.
Collection is declared in the declaration part.
|
|
|
|
|
I don't understand why the collection is shared. If you want to destroy the shared collection with an instance of the class (i.e. any instance of the class) then it would affect all instances of the class.
Have you considered just emptying the collection? Or assigning a new collection object to the shared member variable. You could encapsulate this by creating, say, a Reset() method that either empties the collection, or assigns a new collection to the shared member variable. This would mean that there is at least a collection object, even if it doesn't have any items in it.
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Yep i have assigned a new collection to the shared collection.
|
|
|
|
|
I am using below code for drawing lines on picturebox. I am able to change color in it but when i have passed width as parameter with color in paint event then it gives "Out of memory Exception". I can't understand if color is working then why width is not working in paint event. If i pass static 1 then only it works.
Code:
Enum PathColor
BLUE1 = 0
blue2 = 1
blue3 = 2
blue4 = 3
GREEN1 = 4
green2 = 5
green3 = 6
green4 = 7
RED1 = 8
red2 = 9
red3 = 10
red4 = 11
white1 = 12
black1 = 13
End Enum
Enum penwidth
blue1w = 0
blue2w = 1
blue3w = 2
blue4w = 3
green1w = 4
green2w = 5
green3w = 6
green4w = 7
red1w = 8
red2w = 9
red3w = 10
red4w = 11
whitew = 12
blackw = 13
End Enum
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Create GraphicsPath for each color
Me.picboard.BackColor = System.Drawing.Color.White
'Me.picboard.BackgroundImage = System.Drawing.Image.FromFile(Application.StartupPath & "\white.bmp")
For i As Integer = 0 To 13
path(i, i) = New GraphicsPath
Next i
' Create each color
myUserColor(PathColor.RED1) = myUserColor(PathColor.RED1).Red
myUserColor(PathColor.red2) = myUserColor(PathColor.red2).Red
myUserColor(PathColor.red3) = myUserColor(PathColor.red3).Brown
myUserColor(PathColor.red4) = myUserColor(PathColor.red4).Brown
myUserColor(PathColor.BLUE1) = myUserColor(PathColor.BLUE1).Blue
myUserColor(PathColor.blue2) = myUserColor(PathColor.blue2).Blue
myUserColor(PathColor.blue3) = myUserColor(PathColor.blue3).Cyan
myUserColor(PathColor.blue4) = myUserColor(PathColor.blue4).Cyan
myUserColor(PathColor.GREEN1) = myUserColor(PathColor.GREEN1).Green
myUserColor(PathColor.green2) = myUserColor(PathColor.green2).Green
myUserColor(PathColor.green3) = myUserColor(PathColor.green3).Yellow
myUserColor(PathColor.green4) = myUserColor(PathColor.green4).Yellow
myUserColor(PathColor.white1) = myUserColor(PathColor.white1).White
myUserColor(PathColor.black1) = myUserColor(PathColor.black1).Black
myPenWidth(penwidth.blue1w) = 5
myPenWidth(penwidth.blue2w) = 5
myPenWidth(penwidth.blue3w) = 5
myPenWidth(penwidth.blue4w) = 5
myPenWidth(penwidth.red1w) = 5
myPenWidth(penwidth.red2w) = 5
myPenWidth(penwidth.red3w) = 5
myPenWidth(penwidth.red4w) = 5
myPenWidth(penwidth.green1w) = 5
myPenWidth(penwidth.green2w) = 5
myPenWidth(penwidth.green3w) = 5
myPenWidth(penwidth.green4w) = 5
myPenWidth(penwidth.whitew) = 5
myPenWidth(penwidth.blackw) = 5
End Sub
Private Sub picboard_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles picboard.Paint
' Try ' error trapping
'myUserColor = (System.Drawing.Color.Black) 'You can remove this line and add a user selected color to
'change the value of myUserColor
If undo = True Then
For i As Integer = 0 To 13
path(i, i) = New GraphicsPath
path(i, i).Reset()
Next i
'Dim g As Graphics = picboard.CreateGraphics()
'g.Clear(Color.White)
'e.Graphics.Clear(System.Drawing.Color.White)
'g.Dispose()
Else
If SetEraser = True Then
myAlpha = 100
picboard.Cursor = New System.Windows.Forms.Cursor("C:\icons\8.ico")
'picboard.Cursor = New System.Windows.Forms.Cursor(Application.StartupPath & "\8.ico")
'Dim CurrentPen = New Pen(Color.FromArgb(myAlpha, System.Drawing.Color.White), 5) 'Set up the pen
'e.Graphics.DrawPath(pen1, mousePath) 'draw the path!
For index As Integer = 0 To 13
'Dim CurrentPen = New Pen(Color.FromArgb(myAlpha, myUserColor(index)), myPenWidth(index)) 'Set up the pen
Dim CurrentPen = New Pen(Color.FromArgb(myAlpha, myUserColor(index)), myPenWidth(index)) 'Set up the pen
'Dim CurrentPen = New Pen(Color.White) 'Set up the pen
e.Graphics.DrawPath(CurrentPen, path(index, index)) 'draw the path!
'e.Graphics.DrawPath(currentpen, mousePath)
'''If (picboard.Image Is Nothing) Then picboard.Image = New Bitmap(picboard.Width, picboard.Height)
'''Dim g As Graphics = Graphics.FromImage(picboard.Image)
'''g.DrawPath(CurrentPen, path(index, index))
Next index
Else
picboard.Cursor = New System.Windows.Forms.Cursor("C:\icons\pen.ico")
myAlpha = 100 ' This will give the color a Alpha effect, you can set this to 255 if you want a full color
'*********************** NOTE ***********************************************
'The line below set the pen up with the ability to add user selected Alpha, Color and Penwidth
' A simpler, but less flexible solution would be to replace the line with the following code:
'Dim CurrentPen = New Pen(System.Drawing.Color.Black, myPenWidth)
'************ End Note ***************************
' Paint all the GraphicsPath one color at a time
'''whitescreen = False
'''blackscreen = False
For index As Integer = 0 To 13
Dim CurrentPen = New Pen(Color.FromArgb(myAlpha, myUserColor(index)),mpenwidth(index)) 'Set up the pen
'Dim CurrentPen = New Pen(Color.FromArgb(myAlpha, myUserColor(index))) 'Set up the pen
e.Graphics.DrawPath(CurrentPen, path(index, index)) 'draw the path!
'''If (picboard.Image Is Nothing) Then picboard.Image = New Bitmap(picboard.Width, picboard.Height)
'''Dim g As Graphics = Graphics.FromImage(picboard.Image)
'''g.DrawPath(CurrentPen, path(index, index))
Next index
End If
'MsgBox("Not happening!")
'End Try
End If
End Sub
Regards
Megha
|
|
|
|
|
Hi;
I do not have a definitive answer for you. What I believe is happening is when you go to draw with the e.Graphics.DrawPath function, that function fails with the “out of memory” exception. I believe there are too many points in the GraphicsPath object. You can prove this fore yourself by storing the start X and Y during mouse down event and add the line during the mouse up event to the GraphicsPath . You will only have two points for each line but the program will work. The only difference between the two is the number of points in GrapthicsPath.
One other points, the variable path( , ) should only be a one dimensional array such as path(13) would work fine.
I hope this was of some help.
|
|
|
|
|
Hi I have a program which is a gui for a command line program. The command line program calls ntvdm. Heres the part I need help with.
I have redirect the output to a textbox this works fine as long as I don't run the functions that use ntvdm.exe if I do then the output will not redirect until the end of it processing (can be a very long time) while if I run the command line with the gui it prints directly to cmd.exe as it goes.
Pretty much I was wondering if anyone knows how to get the output to show up line for line when it uses ntvdm.exe?
I've tried everything and need help (well everything I can think of)
Jay
|
|
|
|
|
NTVDM is the NT Virtual DOS Machine and every DOS application, or 16-bit Windows 3.1 app, run in it. What do you by "using the functions in ntvdm"? If your application writes directly to the screen buffer, there's no way your going to capture the output using redirected streams because the output isn't being shown using the standard console streams.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
okay the program uses the nt dos for some functions then passes the output over. So I guess I won't be able to capture it until its done.
was worth a try thanks for your help
Jay
|
|
|
|
|
Having a weird problem. On some of my forms, my textboxes are appearing flat with a blue border around them instead of fixed3d. My property for the textbox says BorderStyle Fixed3D. I'm using vb.net 2003. Anyone come accross this problem?
"The things that will destroy us are: politics without principle; pleasure without conscience; wealth without work; knowledge without character; business without morality; science without humanity; and worship without sacrifice."
-Mahatma Gandhi (1869-1948)
|
|
|
|
|