I neglected to include my DB creation script in my Git repo to bring it home for some weekend get-ahead work. Now I thought the lauded 'Generate Database from Model' feature would be my saviour here, but it's useless. It uses the entity set names to generate table names, so where all my original table names were singular, the generated ones are plural.
Some wag at StackOverflow suggested making all the entity set names singular but all I can think of is somehow extracting all original table names, generating the script, then doing a marathon search and replace. Any suggestions on how I could do this? Any other suggestions?
Disclaimer: This is a duplicate of my StackOverflow question here.
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 membersPrivate image As Image
Private FirstTime AsBoolean = True'flag to indicate the pressed statePrivate bPushed AsBooleanPrivate m_bmpOffscreen As Bitmap
bPushed = False'default minimal sizeMe.Size = New Size(21, 21)
EndSubProtectedOverridesSub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim gxOff As Graphics 'Offscreen graphicsDim imgRect As Rectangle 'image rectangleDim backBrush As Brush 'brush for filling a backcolor'If (m_bmpOffscreen.Equals(Nothing)) Then 'Bitmap for doublebufferingIf (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 controlDim 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 keyDim 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'Prepare rectangleDim 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
Thank you halabella for your answer.
It can be a possibility but in this way I think you lose the behavior of the button (button pressed - button not pressed).
In my particular case I could just use an image because the text I need to write is a symbol of a font type not included in my Windows CE (for this reason I need to put an image in a button) but there would be much difference aesthetically with the other buttons of the form.
...but perhaps I could change the image on the click event... yes, it is a possibility.
Don't know if it helps, but there's a <a href="http://msdn.microsoft.com/en-us/library/de8fssa4.aspx">BitConverter</a>[<a href="http://msdn.microsoft.com/en-us/library/de8fssa4.aspx" target="_blank" title="New Window">^</a>] available. There's an example of it's usage on the same page.