Hey..I'm new to VB.net programming and i'm having a problem with my project.
here's a sample code
Private Sub MinsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MinsToolStripMenuItem.Click
Dim b As Boolean
MsgBox(" pop up will return on " & Now.AddMinutes(5))
Dim a = Now.AddMinutes(5)
b = System.Convert.ToBoolean(a)
Catch exception As System.InvalidCastException
If a = True Then
What i want is that after I click the MinsToolStripMenuItem, it will wait for five mins and after that, popupnotifier will popup..
I am using Entity Framework 1.0, I have Claims Table as master table and Requests Table as details table. First I am deleting data from Requests (details) table and then I am trying to delete data from master table.
Even though there is no record exists in Requests table I am unable to delete rows from Claims table, it is throwing FK relationship exception. What could be the reason? I am not understaing because when there is no recod exists in Details table for the Master table record. Then that record in Master table should be easily deleted.
I am trying my best to resolve is, any body if they have any idea please help me.
I am trying to google too, but if anybody have any idea, it would be great if they help me.
Some general possibilities
- There is still something in details.
- The way you coded the details delete in the framework is wrong.
- The framework is handling the delete for you as a batch but when it does the real commit it is doing the master delete first.
I need to pu an image in a button but my application runs in Windows CE so I'm using the Compact Framework and in this context the object Button has no property like Image, BackgroundImage, Bitmap or something similar.
Anybody knows how I can do?
Well... I can't say that I have understood everything in the MSDN example but I managed to convert it to Visual Studio .NET 2008 and to make it work!!!!
Yes, it would be easier something like Button.BkImage("image.bmp") but ... it seems that the Compact Framework is missing many things that I need!!!
Once again, Thank you Eddy!!
I publish the code of MyImageButton class if it can help someone or anyone has any corrections to suggest.
Private image As Image
Private FirstTime AsBoolean = True'flag to indicate the pressed state
Private bPushed AsBooleanPrivate m_bmpOffscreen As Bitmap
bPushed = False'default minimal size
Me.Size = New Size(21, 21)
EndSubProtectedOverridesSub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim gxOff As Graphics 'Offscreen graphics
Dim imgRect As Rectangle 'image rectangle
Dim backBrush As Brush 'brush for filling a backcolor
'If (m_bmpOffscreen.Equals(Nothing)) Then 'Bitmap for doublebuffering
If (FirstTime) Then
m_bmpOffscreen = New Bitmap(ClientSize.Width, ClientSize.Height)
gxOff = Graphics.FromImage(m_bmpOffscreen)
If (Not bPushed) Then
backBrush = New SolidBrush(Parent.BackColor)
Else'change the background when it's pressed
backBrush = New SolidBrush(Color.LightGray)
If (Not image.Equals(DBNull.Value)) Then'Center the image relativelly to the control
Dim imageLeft AsInt32 = (Me.Width - image.Width) / 2Dim imageTop AsInt32 = (Me.Height - image.Height) / 2If (Not bPushed) Then
imgRect = New Rectangle(imageLeft, imageTop, image.Width, image.Height)
Else'The button was pressed
'Shift the image by one pixel
imgRect = New Rectangle(imageLeft + 1, imageTop + 1, image.Width, image.Height)
EndIf'Set transparent key
Dim imageAttr As ImageAttributes = New ImageAttributes()
gxOff.DrawImage(image, imgRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imageAttr)
EndIfIf (bPushed) Then'The button was pressed
Dim rc As Rectangle = Me.ClientRectangle
rc.Width -= 1
rc.Height -= 1'Draw rectangle
gxOff.DrawRectangle(New Pen(Color.Black), rc)
EndIf'/Draw from the memory bitmap
e.Graphics.DrawImage(m_bmpOffscreen, 0, 0)
EndSubPrivateFunction BackgroundImageColor(ByVal image As Image) As Color
Dim bmp As Bitmap = New Bitmap(image)
Return bmp.GetPixel(0, 0)
EndFunctionProtectedOverridesSub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
EndSubProtectedOverridesSub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
bPushed = TrueMe.Invalidate()
EndSubProtectedOverridesSub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
bPushed = FalseMe.Invalidate()
EndSubPublicProperty MImage() As Image
EndGetSet(ByVal value As Image)
image = value
Last Visit: 31-Dec-99 18:00 Last Update: 19-Sep-14 8:48