Click here to Skip to main content
15,929,253 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionDelete old file [modified] Pin
VK-Cadec22-Aug-06 4:31
VK-Cadec22-Aug-06 4:31 
AnswerRe: Delete old file Pin
Ray Cassick22-Aug-06 16:20
Ray Cassick22-Aug-06 16:20 
Questionambiguous namespace Pin
BlueKooZZZZZZZZ22-Aug-06 4:11
BlueKooZZZZZZZZ22-Aug-06 4:11 
AnswerRe: ambiguous namespace Pin
Ray Cassick22-Aug-06 16:18
Ray Cassick22-Aug-06 16:18 
QuestionNewbie class error Pin
asfila22-Aug-06 3:51
asfila22-Aug-06 3:51 
AnswerRe: Newbie class error Pin
Guffa22-Aug-06 6:12
Guffa22-Aug-06 6:12 
Questionhow to install/use webcam in Vb 6.0? Pin
whippersnapper7622-Aug-06 2:40
whippersnapper7622-Aug-06 2:40 
QuestionHandling System.Runtime.InteropServices.ExternalException] {System.Runtime.InteropServices.ExternalException} System.Runtime.InteropServices.ExternalException in .Net Pin
psmukil22-Aug-06 2:15
psmukil22-Aug-06 2:15 
Hi all,

Im using a windows form and on mouse down on a label i want to draw an rectangle on the label. Its working fine when the label without border. But When i have the label with border, after clicking the label for the fisrt time its throwing "System.Runtime.InteropServices.ExternalException" . and an Generic GDI+ Error.

In DrawRectangle function i removed the border of the control by converting the control to a label inroder to have that BorderStyle Property. I think problem might have occured in this line of code.

and its not drawing the rectangle, for the second time mouse down, its working fine and draws the rectangle properly.

Whats could be the problem, Please guide me. I was struggling with this error for the past two days. Code is given below.


Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown
If CInt(Label1.Tag) = 0 Then
Label1.Tag = 1
DrawRectAngle(Label1)
ElseIf CInt(Label1.Tag) = 1 Then
Label1.Tag = 2
Label1.Refresh()
DrawCrossLine(Label1)
Else
Label1.Tag = 0
Label1.Refresh()
End If
End Sub


Private Sub DrawRectAngle(ByVal ControlName As Control)
Dim RectPen As New Pen(Color.Lime)
RectPen.Width = 6
g = ControlName.CreateGraphics()
Try
If TypeOf ControlName Is System.Windows.Forms.Label Then
CType(ControlName, Label).BorderStyle = BorderStyle.None
End If
Dim rect As Rectangle
rect = New Rectangle(1, 1, ControlName.Width, ControlName.Height)
g.DrawRectangle(RectPen, rect)
Catch ex As Exception

End Try
End Sub



Regards
Mukilan.
Questionshowpopup help. Pin
popalzai22-Aug-06 2:12
popalzai22-Aug-06 2:12 
AnswerRe: showpopup help. Pin
Dave Sexton22-Aug-06 2:51
Dave Sexton22-Aug-06 2:51 
GeneralRe: showpopup help. Pin
popalzai22-Aug-06 4:52
popalzai22-Aug-06 4:52 
GeneralRe: showpopup help. Pin
Dave Sexton28-Aug-06 2:43
Dave Sexton28-Aug-06 2:43 
GeneralRe: showpopup help. Pin
popalzai29-Aug-06 4:29
popalzai29-Aug-06 4:29 
GeneralRe: showpopup help. Pin
Dave Sexton29-Aug-06 21:24
Dave Sexton29-Aug-06 21:24 
GeneralRe: showpopup help. Pin
popalzai2-Sep-06 4:21
popalzai2-Sep-06 4:21 
GeneralRe: showpopup help. Pin
Dave Sexton4-Sep-06 2:41
Dave Sexton4-Sep-06 2:41 
Questionsetup package(answer very fast) Pin
md_refay22-Aug-06 0:50
md_refay22-Aug-06 0:50 
AnswerRe: setup package (very fast answer) Pin
Guffa22-Aug-06 6:14
Guffa22-Aug-06 6:14 
Questionsound Pin
md_refay22-Aug-06 0:45
md_refay22-Aug-06 0:45 
AnswerRe: sound Pin
Polymorpher28-Aug-06 17:44
Polymorpher28-Aug-06 17:44 
Questiondate format Pin
md_refay22-Aug-06 0:43
md_refay22-Aug-06 0:43 
QuestionHow to send & recive parameters from .net exe to another .net exe Pin
jagmit2021-Aug-06 21:25
jagmit2021-Aug-06 21:25 
AnswerRe: How to send & recive parameters from .net exe to another .net exe Pin
Christian Graus21-Aug-06 22:26
protectorChristian Graus21-Aug-06 22:26 
QuestionNeed some help - Storing Image and text data in access DB Pin
Jats_4ru21-Aug-06 20:45
Jats_4ru21-Aug-06 20:45 
AnswerRe: Need some help - Storing Image and text data in access DB Pin
rabih_kai21-Aug-06 21:42
rabih_kai21-Aug-06 21:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.