|
You can do it in two ways.
1. Have a hidden form that has this timer and which can be controlled by other forms (ungainly approach)
2. Create an instance of System.Timers.Timer in your MDI Form, add an event delegate to the Elapsed event of the Timer object you created and have your email logic put in a separate class file, which can be called from the Elapsed event.
The Timer you see in the toolbox is the Windows.Forms.Timer object, apart from this, you can also use System.Timers.Timer and System.Threading.Timer.
Regards,
SG
|
|
|
|
|
Hello,
Thanks for your reply.
The 2 option sounds like the best. Can this be extended for many timers. As the user will want to be able to create many timers for many jobs. for example, if they have 5 jobs open, it should send 5 e-mails every 5 minutes.
Many thanks,
Steve
|
|
|
|
|
You shouldn't be setting up Timers all over the place. Your code should be written to fire a single Timer every minute, then in the event, check the current system time against the scheduled execution times of various items.
There is a limit to the number of Timers a single process can run. I think it's 32, but I seem to remember something about the type of timer being used too.
|
|
|
|
|
Hi All,
Please help me for packet drop/pass using VB6.
I have found winpcap and vbpcap for capturing packet but vbpcap is still not support packet drop/pass. Please help me for packet drop/pass.
|
|
|
|
|
You can't do this in VB6. This requires writing a device driver for the network stack to support passing or dropping packets.
|
|
|
|
|
I have a class inherited from Control Class
Public Class MyClass
Inherits System.Windows.Forms.Control
End Class
Now when i am creating object of MyClass, I am getting so many events, properties and methods of Control class. Out of all the events, properties and methods, i want to completely hide few of them.
Is there any way to do that?
|
|
|
|
|
you can't hide any of the properties. however you can put a class infront of your class that only exposes what you want
Public Class mytest
Private mB As B
Public Property Text() As String
Get
Return mB.Text
End Get
Set(ByVal value As String)
mB.Text = value
End Set
End Property
Public Sub New()
mB = New B
End Sub
Protected Class B
Inherits System.Windows.Forms.Control
End Class
End Class
|
|
|
|
|
Thanks for your answer. This is a good way around. but by this way, i cannot add object of mytest as a Control in my form.
|
|
|
|
|
Hi all,
I have a variable(String) that i want to store it in resources file so that i can retrieve it's value in coding process. But unfortunately, in coding process, i need to change it's value.
Ex : I have a variable MyName that is stored in resources
+ begin : MyName = "FirstForm"
+ after changing : MyName = "SecondForm"
How could i change MyName's value from "FirstForm" to "SecondForm" ?
|
|
|
|
|
Resources are Read Only. You'll have to save this information somewhere else.
|
|
|
|
|
Hallo,
I wrote this code, it works and it magnify "MyPicture" 8 times to the Form1.
Now my question:
Is there a possibility to use the bitmap of a PictureBox for the Destination of
StretchBlt, or copy the destination to a PictureBox?
Thanks for answerig, Hans-Christian
Imports System.Runtime.InteropServices<br />
<br />
Public Class Form1<br />
Dim srcImage As New Bitmap("MyPicture.bmp", True)<br />
Dim Graph As Graphics = Me.CreateGraphics<br />
Dim desHdc As IntPtr = Graph.GetHdc()<br />
<br />
Dim srcHdc As IntPtr = CreateCompatibleDC(IntPtr.Zero)<br />
Dim hBitmapSrc As IntPtr = srcImage.GetHbitmap()<br />
<br />
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
<br />
SelectObject(srcHdc, hBitmapSrc)<br />
SetStretchBltMode(desHdc, 13369376)<br />
StretchBlt(desHdc, 0, 0, 4096, 4096, _<br />
srcHdc, 0, 0, 512, 512, _<br />
TernaryRasterOperations.SRCCOPY)<br />
<br />
End Sub
|
|
|
|
|
Beginner_HC wrote: Public Class Form1
Dim srcImage As New Bitmap("MyPicture.bmp", True)
Dim Graph As Graphics = Me.CreateGraphics
Dim desHdc As IntPtr = Graph.GetHdc()
Dim srcHdc As IntPtr = CreateCompatibleDC(IntPtr.Zero)
Dim hBitmapSrc As IntPtr = srcImage.GetHbitmap()
This is a REALLY bad idea. Make this stuff class-scoped will cause you severe problems later on. You should ALWAYS Create, Use, then Destroy your graphics object only when you need them and only for as long as you need them. Caching one like this doesn't do you any good because some operations will only be commited when the Graphics object is finally destroyed.
What are you trying to do with this code again? You OP wasn't very clear about what your doing with this. What's the ultimate goal here?
|
|
|
|
|
Hi Dave,
what I am actually like to realise is to magnify a Picture 8 times,
every pixel should become a small rectangle.
And I like to hafe this magnification as a bitmap that can be shown in a PictureBox,
becaus than I can scroll the form of the PictureBox without loosing the Picture when it is coverd
by a other Form.
Regards,
Hans-Christian
|
|
|
|
|
For a beginner, you're tackling a pretty complex subject with Win32/GDI...
OK... It's a real pain, but here goes. Of course, you have to have the Declares for StretchBlt, SelectObject, DeleteObject, and DeleteDC created to use this...
Private Sub CreateMagnifiedImage(ByVal MagFactor As Integer, ByVal srcBitmap As Bitmap) As Bitmap
If srcBitmap IsNot Nothing Then
Dim magSize As New Size(srcBitmap.Width * MagFactor, srcBitmap.Height * MagFactor)
Dim magBitmap As New Bitmap(magSize.Width, magSize.Height)
Dim g As Graphics = Graphics.FromImage(magBitmap)
DrawMagnifiedImage(g, srcBitmap, magSize)
g.Dispose()
End If
End Sub
' This is the code Ive used before to magnifiy an image...
Private Sub DrawMagnifiedImage(ByVal gTarget As Graphics, ByVal srcBitmap As Bitmap, ByVal newSize As Size)
Dim hBmp as IntPtr = srcBitmap.GetHbitmap()
Dim hdcTarget As IntPtr = gTarget.GetHdc()
Dim hdcSource As IntPtr = CreateCompatibleDC(hdcTarget)
Dim hOrig As IntPtr = SelectObject(hdcSrc, hBmp)
StretchBlt(hdcTarget, 0, 0, newSize.Width, newSize.Height, hdcSource, 0, 0, srcBitmap.Wdith, srcBitmap.Height, TernaryRasterOperations.SRCCOPY)
SelectObject(hdcSource, hOrig)
DeleteObject(hBmp)
DeleteDC(hdcSource)
gTarget.Release(hdcTarget)
End Sub
|
|
|
|
|
Hi Dave,
Thank you! This was it was I am looking for, since weeks!
Hans-Christian
|
|
|
|
|
can anybody let me the oops concept in .net with an example. how to use polymorphism, abstract class, encapsulation in our application.
thanks for your help.
Rafeeque
|
|
|
|
|
With "an example"?? That's simply not possible. OOP concepts take entire books to cover. One or two examples in a forum environment simply is not going to be enough to cover the huge scope of your question. About the only suggest we can make is to get a compule of books. Search Amazon for "OOP VB.NET" or "VB.NET Beginner" and you'll come up with a bunch of them.
|
|
|
|
|
Sounds more like general homework questions to me.
__________________
Bob is my homeboy.
|
|
|
|
|
Doesn't change my answer!
|
|
|
|
|
Dave Kreskowiak wrote: Doesn't change my answer!
Yep. Homework or not, same answer
|
|
|
|
|
I wasn't disagreeing with your answer!
__________________
Bob is my homeboy.
|
|
|
|
|
i know its not simple to explain. give some brief notes or good links for encapsulation, polymorphism, abstract class with some coding example. and how it will use in our application.??
thanks for your help
|
|
|
|
|
You're still asking for WAY TOO MUCH information for a forum environment. Don't make me repeat myself.
|
|
|
|
|
Dear Mr. Dave Kreskowiak
Microsoft MVP Visual Developer
Thanks for your help. If you don't want to give me a link, tell me clearly. why r u dropping such kind of hurt message. Anyhow one of my good friend given the following link
http://www.c-sharpcorner.com/UploadFile/eecabral/OOPSand.NET211102005075520AM/OOPSand.NET2.aspx
Thanks for your co-operation.
Regards
Rafeeque Ahmed
|
|
|
|
|
That article just scrathes the surface. There's far more to OOP than what's in that article.
|
|
|
|