|
Exactly I am doing that.
But When a Modal form is open as show dialog the whole thing is Flikering
I need a smooth work.
|
|
|
|
|
What's flickering?? The entire Desktop or just the form you change the Opacity on? Did you try turning on DoubleBuffering on your forms?
|
|
|
|
|
Changing the Double Buffering on but the Problem same
Change the Double Buffering in all the Forms or just the modal form
|
|
|
|
|
hello tyhere , i really need a working project for marksheet development in vb 6 , if anyone can create for me aur tell me the codings for it , than i'll be really very thanful to one...............
thanx a million in advance..............
|
|
|
|
|
That's just not going to happen. We don't just hand over completed projects. We'll help you write your own code, but we won't write it for you.
BTW, what do you mean by "marksheet"??
|
|
|
|
|
Hi All!
In my application, i am trying to add an event handler at runtime using AddHandler, but cannot seem to find how to pass an argument with that event handler, for instance:
Function SomeHandler(ByVal MyMessage As String)
MsgBox(MyMessage)
Return 0
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler Button1, AddressOf SomeHandler("Hello World!")
End Sub
This Will Not work, I'm told that I have to state the function name, without parentheses.
How would I use this method to pass arguments to an event handler function?
Thanks!
MrWolfy
|
|
|
|
|
You don't pass arguments in AddHandler. It does exactly that, no more. AddHandler wires up an event to a method handling that event. AddHandler does not Raise the event. That's done using, oddly enough, the RaiseEvent statement.
MrWolfy wrote: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AddHandler Button1, AddressOf SomeHandler("Hello World!")End Sub
Your code wont event compile because you haven't told AddHandler which event to wire up to SomeHandler.
|
|
|
|
|
Dave,
that's not true is it? RaiseEvent will only work with the keyword 'event'
Example:
Private Event Test
Private sub ClickMe()
RaiseEvent Test
End Sub
======
You cannot raiseevent of another object that has built in events (where you didn't use the keyword 'event')
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
You are correct. There was a guy around here a couple of days ago trying to wire up events the same way you do it in C#. Man did I have my head up my...
|
|
|
|
|
no biggy. Just making sure incase I was missing something. I always thought it would be nice to raise an object's event but MS doesn't let us play that way...
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Hi!
Whoops... Didn't see that sorry! You're right it won't compile, and you were also right about the AddHandler thing. I should have done more research myself. I'm sure I'll find a workaround.
Thanks Again!
MrWolfy
|
|
|
|
|
Hi,
i am writing on a small test-programm wich lists all available trailers on youtube ->
Have a look[^]
I am German so don´t Wonder.
So now the problem is, that i had to write die Draw_Item Event on myself to get this style.
And on every Mousemove, the listview redraws all of it´s Items. And it´s flickering all the time.
Heres my Draw_Item Event:
If e.ItemIndex = Me.SelectedIndex Then
Dim brush As New Drawing2D.LinearGradientBrush(e.Bounds, Color.DodgerBlue, _
Color.White, Drawing2D.LinearGradientMode.Horizontal)
Try
e.Graphics.FillRectangle(brush, e.Bounds)
Finally
brush.Dispose()
End Try
e.Graphics.DrawImage(ImageList1.Images(e.ItemIndex), e.Item.Bounds.X + 2, e.Item.Bounds.Y, 130, 96)
e.Item.Text = " " & Trim(e.Item.Text)
Else
e.Graphics.DrawImage(ImageList1.Images(e.ItemIndex), e.Item.Bounds.X + 2, e.Item.Bounds.Y, 130, 96)
e.Item.ImageIndex = e.ItemIndex
e.Item.Text = "
" & Trim(e.Item.Text)
End If
e.DrawText()
What i tried:
- Setting the DoubleBuffer Property on True
- Suspend and Resume Layout while Drawing
and its still flickering, please help me!! im sitting on this for 24 hours now
if you don´t know how to fix this, a downloadable listview with this style and no flickering would be also helpfull!
best regards
Julian
|
|
|
|
|
1) Make sure all drawing procedures are in their proper painting event. Do not alter graphics from other non-graphic events.
2) To changed graphics from non-graphic events: setup a variable that is checked in the graphic event, set the variable in the non-graphic event, then call Invalidate() to force the proper redraw of the function
3) Look into the SetStyles method. This enables double buffering as well as many other features that will improve painting performance.
4) Look at one of my articles: Basics of Falling Blocks in VB 2005[^]. The article has helped quite a few people in understanding the proper way of drawing graphics in applications.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Hi Thomas,
Point 1 is ensured, im only drawing in the DrawItem Event.
Point 3, i had enabled:
ControlStyles.DoubleBuffer
ControlStyles.Opaque
ControlStyles.AllPaintingInWmPaint
ControlStyles.UserPaint
ControlStyles.OptimizedDoubleBuffer
but all of that dont seem to work.
My English was not good enough to understand point 2, it would be
really great if you would explain it in other words!
regards,
Julian
|
|
|
|
|
DAMN IT WORKS !!! 32 h of endless hate
I made a User Control inherit from the listview control,
and in the constructor i added (like you said):
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.Opaque, True)
This Combination is working!!
Seems like the last time i made something wrong, thanks of you i tried it again,
i also want to recommend This Article[^] + falling Blocks )
My best regards
|
|
|
|
|
I want to find the creation date of an exe. I am using the following code.
Public Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Integer, ByVal dwShareMode As Integer, ByVal lpSecurityAttributes As Integer, ByVal dwCreationDisposition As Integer, ByVal dwFlagsAndAttributes As Integer, ByVal hTemplateFile As Integer) As Integer
Dim fHandle As Integer
fHandle = CreateFile(FileName, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0)
Using this handle, with some more code we can find the creation date.
This is working fine in VB. But not working in VB.net. CreateFile is returning -1 in VB.net.
Could anyone of you please tell me why it is not working in VB.net and is there any other way(methods) to find the creation date of an vb.exe file.
Thanks in advance,
AR Reddy
|
|
|
|
|
Dim file As New System.IO.FileInfo("path to file")
Dim creationdate As DateTime = file.CreationTime
That should do it
|
|
|
|
|
System.IO.File.GetCreation???(string filename)
Look for a method similar to the above in .NET and run it on the specified file.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Dim objFileInfo As New FileInfo("D:\64.jpg")
'To get the creation, lastaccess, lastwrite time of this file
Dim dtCreationDate As DateTime = objFileInfo.CreationTime
Dim dtLastAccessTime As DateTime = objFileInfo.LastAccessTime
Dim dtLastWriteTime As DateTime = objFileInfo.LastWriteTime
Found at:
http://www.devasp.net/net/articles/display/215.html[^]
Or
Dim fileName As String = "C:\MyPath\MyFile.txt"
If File.Exists(fileName) Then
Label_CreationTime.Text =
File.GetCreationTime(fileName).ToString
Label_LastAccess.Text =
File.GetLastAccessTime(fileName).ToString
Label_LastWrite.Text =
File.GetLastWriteTime(fileName).ToString
End If
Found at:
http://www.codeproject.com/KB/dotnet/FileTime.aspx[^]
If you need anymore help. Let me know.
modified 18-Dec-21 21:01pm.
|
|
|
|
|
I am Copying directory from one drive to another using the code below.The Function is working fine but my problem is that Is there any other way that I can reduce time taken to copy the directory.
thanks in advance...
my code is:
Sub CopyDirectory(ByVal SourcePath As String, ByVal DestPath As String, Optional ByVal Overwrite As Boolean = False)
Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath)
Dim DestDir As DirectoryInfo = New DirectoryInfo(DestPath)
' the source directory must exist, otherwise throw an exception
If SourceDir.Exists Then
' if destination SubDir's parent SubDir does not exist throw an exception
If Not DestDir.Parent.Exists Then
Throw New DirectoryNotFoundException _
("Destination directory does not exist: " + DestDir.Parent.FullName)
End If
If Not DestDir.Exists Then
DestDir.Create()
End If
' copy all the files of the current directory
Dim ChildFile As FileInfo
For Each ChildFile In SourceDir.GetFiles()
If Overwrite Then
ChildFile.CopyTo(Path.Combine(DestDir.FullName, ChildFile.Name), True)
Else
' if Overwrite = false, copy the file only if it does not exist
' this is done to avoid an IOException if a file already exists
' this way the other files can be copied anyway...
If Not File.Exists(Path.Combine(DestDir.FullName, ChildFile.Name)) Then
ChildFile.CopyTo(Path.Combine(DestDir.FullName, ChildFile.Name), False)
End If
End If
Next
' copy all the sub-directories by recursively calling this same routine
Dim SubDir As DirectoryInfo
For Each SubDir In SourceDir.GetDirectories()
CopyDirectory(SubDir.FullName, Path.Combine(DestDir.FullName, _
SubDir.Name), Overwrite)
Next
Else
Throw New DirectoryNotFoundException("Source directory does not exist: " + SourceDir.FullName)
End If
End Sub
|
|
|
|
|
I guess you could create the directory structure first and then use multiple threads to copy the files.
|
|
|
|
|
Can u provide any example for that.
I guess that the use of thread will Slow the copy of files as it will take some time to switch over b/w the Threads.
Thanks
|
|
|
|
|
i have here a source code for MSFlexgrid to highlight a specifi cell
or object with a value of greater than 0. i want to know how i'll gonna
increment the selection in MSFlexgrid. i hope you all understand my probelm... ^^
Private Sub Form_Activate()
Dim x As Integer
`x = 2 to skip the fixrow of MSFlexgrid
x = 2
Do Until x = Data1.Recordset.RecordCount
While Data1.Recordset.EOF = False
If Data1.Recordset.Fields("Balance") = MSFlexGrid1.TextArray(x) Then
If Data1.Recordset.Fields("C_Balance").Value > 0 Then
MSFlexGrid1.CellBackColor = vbYellow
Else
MSFlexGrid1.CellBackColor = vbBlue
End If
Data1.Recordset.MoveNext
Else
Data1.Recordset.MoveNext
End If
Wend
x = x + 1
Loop
End Sub
|
|
|
|
|
Hello all,
I was trying to print the text file in vb.net (winform)
After googling i got this code...
Let me explain in detail...
I Create a file at runtime based on user request. user can print that file after viewing it.
I want to show that file in PrintPreviewDialog and if user chooses to print then it can be.
The PrintPage event i m using is as
Dim pd As New PrintDocument
AddHandler pd.PrintPage, AddressOf pd_PrintPage
'Event for printpage
Private Sub pd_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
Dim yPos As Single = 0
Dim count As Integer = 0
Dim leftMargin As Single = 0
Dim topMargin As Single = 0
Dim line As String = Nothing
linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics)
' Iterate over the file, printing each line.
While count < linesPerPage + 9 ' manipulate the pagelength according to your interest
line = streamToPrint.ReadLine()
If line Is Nothing Then
Exit While
End If
yPos = topMargin + count * printFont.GetHeight(e.Graphics)
e.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, _
yPos, New StringFormat)
count += 1
End While
Pgnum = Pgnum + 1
If Not (line Is Nothing) Then
e.HasMorePages = True
count = count + 1
yPos = topMargin + count * printFont.GetHeight(e.Graphics)
e.Graphics.DrawString("Page:" + CStr(Pgnum), printFont, Brushes.Black, leftMargin + 700, _
yPos, New StringFormat)
Else
e.HasMorePages = False
count = count + 1
yPos = topMargin + count * printFont.GetHeight(e.Graphics)
e.Graphics.DrawString("Page:" + CStr(Pgnum), printFont, Brushes.Black, leftMargin + 700, _
yPos, New StringFormat)
End If
End Sub
But i m not sure where i should add this code to show document in oreview
PrintPreviewDialog1.Document = pd
PrintPreviewDialog1.ShowDialog()
am i missing something. or completely wrong?
Thanks.........!
___________________________________________
.Net Developer
|
|
|
|
|
Hi,
I am developing Anti spyware product. I got idea on what is spyware. I have seen different softwares. In that they are searching for memory items, registry items and file items. But how to find those spyware in our system.Based on which exes and dlls we can tell spyware, malware and trojans etc. are present in our system.Please give me some idea on which dlls, exes etc will cause spyware, adware.
Thank you in advance
|
|
|
|
|