|
put the function inside a backgroundthreadworker , which runs in a separate thread , then if the user hits cancel
kill the backgroundthreadworker
HTH
Martin
life is a bowl of cherries
go on take a byte
|
|
|
|
|
Declare An Boolean Variable , while clicking cancel button pass values to that boolean variable , then check the condition using 'if' statement
if boolean = False skip that coding else execute that coding
reply, How It Helped
Prabumj@gmail.com
|
|
|
|
|
Hello,
yes your suggestion would work fine but:
it depends on the complex maths functiion being rewritten to check the boolean value constantly so it does a bit of maaths , checks the flag ,it does a bit of maaths,checks the flag , it does a bit of maaths,checks the flag etc ad nausium
Whereas:
with the threading solution
1. the maths function does not change - only the place it is run from (the background thread worker)
2. When the cancel button is pressed , the code behind can kill the thread instantaniously , so from a user perpestive , it seems more responsive.
what do you think??
thanks
Martin
life is a bowl of cherries
go on take a byte
|
|
|
|
|
in VB.net 2005 I have problems when i try to insert new record in Access database with Update method.The record has a field Autonumber.And after inserting , in dataset the value of this field is 0, in database is ok.
|
|
|
|
|
if you are inserting data by dataadaptor and you donot fill dataset after inserting it can be happen . so I think it is better you fill your dataset after per record inserting .
|
|
|
|
|
Thank you.
The record is inserted in dataset with add(row).But when the dataadapter.update method is executed the record in database is ok , but in dataset the atonumber field is 0.
Yes , is possible to fill again the dataset but the application is running on network and if i fill dataset everytime i add new record slow down the app.
i know there is a method Select identity but i don't know how to do it.
|
|
|
|
|
How do i detect the ring back tone from my application when it dials to cellphones. i.e i want to end the call after a single call back.
Any thing am ready
|
|
|
|
|
Programmatic Missed Call?
|
|
|
|
|
hi all
i draw a polygon on a form and on a control also
now i need to capture the mouse events of that polygon so that the polygon can be placed anywhere on the form or control
the polygon had 5 edges and i need to capture the x and y position of the mouse where the polygon has been released by the mouse on the form
thnx
help everyone
|
|
|
|
|
depends on the language you use
for vb6
when mouse is down (or clicked) a boolean should be changed to true
while the mouse moves this boolean is true and when the mouse is released (or is clicked again) it should be false.and shapes are object by themselves and you can determine x and y in the event subroutine
But for Vb.Net
you have to make your own region and set the region of a usercontrol or control to that region.
now everything is like vb6
A.E.K
|
|
|
|
|
i use vb.net,
can u tell me more about region and a fair idea about the work
how can i find that mouse has been clicked on that graphic because the graphic does not have the mouse events
i have two graphics on the form. how can i differentiate
thnx for reply
help everyone
|
|
|
|
|
The region class is defined in .Net so in vb6 you have to make an ActiveX and change its region to the corresponding shape using API functions.or you can add a control like picturebox to your form and using its hwnd and APIs change its shape.
so when you add this ActiveX to your project you will be able to use its events and a picturebox has its own mouse events.
A.E.K
|
|
|
|
|
i don't have the picture box, i have a graphic object (a polygon) drawn by my self. is it possible with out using api, or any other way to the work.
any other suggestion
help everyone
|
|
|
|
|
If you will store and render the polygon with a GraphicsPath object, you can do hit testing with the properties: .IsVisible and .IsOutlineVisible
I have been using the GraphicsPath object in a vector graphics program I'm writing. You have do hit testing all the time in these types of programs.
Cheers!
Richard
|
|
|
|
|
hi
can u please describe it in some more detailed description
thnx
help everyone
|
|
|
|
|
This is pretty lengthy but I think it will get you going. I had to convert the original code from C# into VB.NET code.
Create a new class and call it: ShapeManager. Once the class file opens, replace all code with this code below: (Note: Copy down until you see: "End Code"
'Start Code below
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Drawing.Drawing2D
Imports System.Drawing
Public Class ShapeManager
'//All shapes will be exposed through this collection
Public Shapes As System.Collections.ArrayList
Public Sub PaintShapes(ByVal g As Graphics)
'note: the clipping area should already be set
'in the graphics object through this.Invalidate()
'We will now loop through all the shapes and paint
'only those that are part of the clipping rectangle.
'Processing is faster if we use a Int in our For loop
'instead of the ArrayList.Count property
Dim intCount As Short = Convert.ToInt16(Shapes.Count - 1)
For intNum As Short = 0 To intCount
'Don't send shape to graphics object if it's bounds
'do not fall inside the clipbounds. This helps when
'you have thousands of shapes and you are only wanting to
'update a small portion of the screen. For more info, do a
'search on Graphics.Clipping
Dim curShape As MyShape = CType(Shapes(intNum), MyShape)
If curShape.IsInsideClipBounds(g.ClipBounds) Then
'ensure that our Path object has been initialized
If Not curShape.Path Is Nothing Then
'Sample paint code
g.FillPath(New SolidBrush(curShape.FillColor), curShape.Path)
g.DrawPath(New Pen(curShape.LineColor), curShape.Path)
End If
End If
Next
End Sub
End Class
Public Class MyShape
Public Path As GraphicsPath
Public LineColor As Color
Public FillColor As Color
Public Sub New()
'Allows us to create a new shape without having to pass
'any initial properties
End Sub
Public Sub New(ByVal gp As GraphicsPath, ByVal lineColor As Color, ByVal fillColor As Color)
'Initialize the shape
Path = gp
lineColor = lineColor
fillColor = fillColor
End Sub
'*** Here's the function that will help you ***
Public Function ContainsMousePoint(ByVal pnt As Point) As Boolean
'A more common name for this function is HitTest but I think
'you'll connect with this name better. The pnt passed to us
'should be the location of the mouse.
If Not Path Is Nothing Then
Return Path.IsVisible(pnt)
Else
Return False
End If
End Function
Public Function IsInsideClipBounds(ByVal clipBounds As RectangleF) As Boolean
Return clipBounds.Contains(Path.GetBounds())
End Function
End Class
'***********************************************************
'***********************************************************
'End Code
The way to wire this up to your form is to trap your form's MouseDown event
and write some code like the example below:
'Example***********
Dim shapeManager As New ShapeManager()
Private Sub frmMain_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
Dim intCount As Short = Convert.ToInt16(shapeManager.Shapes.Count - 1)
For intNum As Short = 0 To intCount
Dim curShape As MyShape = CType(shapeManager.Shapes(intNum), MyShape)
If curShape.ContainsMousePoint(e.Location) Then
MessageBox.Show("The mouse hit me!")
End If
Next
End Sub
'End Example***************************
Hope this helps you!
Richard
may your code be error free
|
|
|
|
|
hello frnds,
can i get the following thing using VB 6.0
1. IP address of My Computer
2. my computer is working under which server
please help....
thankx in advance
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Dim getipaddress As String
Dim xAddr As System.Net.IPAddress
Dim vAddr As String
With System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName())
xAddr = New System.Net.IPAddress(.AddressList(0).Address)
vAddr = xAddr.ToString
End With
getipaddress = vAddr
MsgBox(getipaddress)
that's the syntax for .net but i'd imagine it would be somewhat similar in 6
|
|
|
|
|
thaknx Froz,
BUT r u sure it is run under VB 6.0 environment
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
it's for vb 2005, so I don't know how the vb 6 will look... I think it will look real close tho.
|
|
|
|
|
No, the VB6 code won't look ANYTHING like this. Most of your code uses classes in the .NET Framework that don't exist in VB6.
|
|
|
|
|
This example[^] shows how to resolve an IP Address to a DNS name and the other way around, name to IP.
Here's another example[^] speeling out how to get the machines host name and IP.
|
|
|
|
|
1.Press Ctrl+T
2.Check The Microsoft Winsock Control 6.0
3.Add It To Your Form.
4.Winsock1.LocalIP Shows Your IP
A.E.K
|
|
|
|
|
|
Thankx To all for your valuable Replys,
Just....Keep on Posting
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|