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
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.
My C# solution contains several EXE's and one DLL. All of the EXE's hold references to the DLL because they all depend upon the types implemented by the DLL.
Now, even if I make a trivial change to the DLL that does not alter the public interfaces and methods of its types, Visual Studio rebuilds not only the DLL, but also all of the EXE's that depend upon it.
So my question is: Must I redistribute the rebuilt EXE's as well as the rebuilt DLL, even if my changes to the DLL do not alter any public interfaces or methods?
It seems to defeat the purpose of putting widely used types into a common DLL, if I must rebuild and redeploy any EXE's that use the DLL after making strictly internal changes to the DLL.
Thank you for reading my question.
The difficult we do right away...
...the impossible takes slightly longer.
I got a requirement of applying method level security for the logged in user.
What they just instructed is:
for every method in the code there will be corresponding binary code ..
and for each permission for this method there will be binary code too..
Now when user log in window application it will be checked if this user has permission to execute this method.
I dont have any idea about this..
can anybody provide good links for it or if someone has ever implemented this sort of thing.. Help me out..
You could use the RoleProvider to determine whether or not the user has the appropriate permission to execute a particular method.
I will say, however, that you should be approaching this from the perspective of what the user sees rather than locking off individual methods. In other words, it's better to prevent the user from being able to see a menu option/click it, than it is to let them click it and then tell them that they didn't have the appropriate permission to execute the method.
As you haven't stated what technology you are using, this is as close as I'm going to be able to give you a full answer without overloading you with details for technologies you aren't interested in.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
I used to encrypt and store my applications (Web Forms – Windows Forms) user password in the database.
I usually during the creation of a new user, I get the user password as a plain text and I create a new hash value then I encrypt the concatenation of the password plain text and the hash value. I store both the encrypted password and the hash value in the database.
During the user login authentication process I get the supplied user password as plain text then I retrieve the stored hash and the encrypted password for that user from the database. I repeat the same encryption again which I used during the new user creation operation but with concatenation of the retrieved hash from the database and the supplied plain text password then I compare both the database retrieved encrypted password with new encrypted password. If they are matching the login validation passes otherwise it fails.
I used to use "FormsAuthentication.HashPasswordForStoringInConfigFile" in the namespace "System.Web.Security" to encrypt the passwords for both of my windows Forms and web forms applications. But now with the .Net framework 4.5 the following method:
"HashPasswordForStoringInConfigFile(Password as string, PasswordFormat as string) as string" is obsolete.
Please anyone have any idea what is the new alternative for this method?
does VS put some files in Bin, and other files elsewhere?
Yes. Take a look at the directory structure under your solution directory and you will see the other directories. You can also look through your project properties to see which part of the build uses which directories.
One of these days I'm going to think of a really clever signature.
You could change the output path by simply setting the output path attribute in the project's Build properties.
They could be put elsewhere so long as all the dependent dll's are also available in the same folder.
I am getting following error when I am trying to assign a null value or nuthing value to a variable of type Nullable(Of Decimal).
But for that variable I want to assign a decimal value or null value. The same kind of problem I faced with Nullable (of DateTime) too. It cant take a nothing assigned to it. If it cant take that value then why is it nullable(of Decimal) or Nullable (of DateTime) and System.Nullable(Of Integer) is also not taking null values (means nothing value in VB.Net).
Please help me in resolving this issue.
thanks in advance.
Below is my code: I tried by just putting variable=nothing also but didnt work.
OK. Thanks Dave. That clears it up. The text box values are not of consequence but if they are null it is a problem. Trying to add them to a listbox is rejecting null strings. Position in the list box is critical for each item added so a place holder needs to be added.
We have a new requirement that a daily file transfer of client data be encrypted with PGP. I would rather not rely on a blackbox solution, as I want to make sure that the file is not being secretly sent off somewhere.
Can anyone help me find .Net source code to do PGP encryption/decryption? C# or VB.net are both fine, I can work with either. I do not need -- and frankly, would rather avoid -- all of the other bells and whistles that have become common with PGP packages. All I need is file encryption and decryption using an public/private key that follows the PGP protocols.
i am working with C# application, which has some memory leak problem. When i checked with profiler, i saw private bytes are being increased continuously and after some times it is getting crashed. Can any one tell me what is "Private bytes" and what is the main reason of its increase in size without any request .
Without knowing anything at all about your application, this question is impossible to answer.
Is it a Windows Forms app, WPF, ASP.NET, Silverlight, ... What? What does the application do? What is it doing when this "leak" occurs? Is it idle? Is it doing something in the background? Is it using some 3rd party components? What's the error message, if any, when it crashes?
Where are you getting this statistic from? DO NOT USE TASK MANAGER!
I am using MSI to create setup. I already added prerequisite (.NET framwork 3.5) into MSI.
I have selected option i.e. Download prerequisite fromthe same location as my application
While installing setup on windows XP SP3 its showing error .NET framework is not installed on the machine. Setup is not installing .NET framework from MSI.
Even I added all framework files and folders into application folder and program files folder.
Is I am doing any wrong? can pls let me know the steps how can i used my prerequisite .NET framework 3.5 on windows XP SP3 even not framework is available.
I am using EF 1.0 trying to update a column called doc id which is nullable column, but the EF is updating the other column also along with this column. There is no other place that I am updating that column mistakenly.
Is there any way that I can avoid this kind of situation happening. Because it is happening only in Integration Env, but not in Dev. I dont know what to do now. Please help me.
I am using Visual Studio 2008 to develop web application in Windows XP Internet explorer-8. If i run first time i wont get any error. In 2nd time i will get Unable to start program http://localhost:1837/default.aspx after that every time it is coming like that. I am not able to get debug point. How to solve this issue.
If anybody knows, please reply me.
thanks in advance.
modified 19-Dec-12 6:13am.
Last Visit: 31-Dec-99 19:00 Last Update: 26-Nov-14 19:43