|
Jazeker:
My solution to this problem is to write a function ReplNull which returns a default when a value is Null:
Public Function ReplNull(ByVal varSource As Variant, _<br />
ByVal varReplaceBy As Variant) As Variant<br />
<br />
If IsNull(varSource) Then<br />
ReplNull = varReplaceBy<br />
Else<br />
ReplNull = varSource<br />
End If<br />
<br />
End Function
Or use the CASE WHEN clause in your SQL statement to replace Nulls by your default.
grtz,
Guus
|
|
|
|
|
Hi, Can someone help me with this problemo.
I'm trying to get the context menu to popup only when a specific cursor is showing over the control.
The control switches cursor ( default to hand and back ) when double clicked.
I want the context menu only to popup when the mouse is right clicked AND when the hand cursor is showing.
It works for the first time I switch to hand cursor but once I select a menuItem on contextmenu, the contextmenu pops up with both cursors there after.
Thanks
|
|
|
|
|
hi,KEITHSTER
i hope the following code snippet will help you
first put a contextmenu control and a button control in the form
then at the code part
Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
If e.Button = MouseButtons.Right And Me.Button1.Cursor Is System.Windows.Forms.Cursors.Hand Then
ContextMenu1.Show(Button1, New Point(0, 0))
End If
End Sub
Good luck!
if it still not work,put your code here
I try my best!
|
|
|
|
|
Hi,
I've been trying to access the physical memory (BIOS) from my program, but can't seem to make it work.
Is there anybody who knows how to do it, and could you possibly post some info about this?
Plezzz help me !
--[ There are 10 kinds of people in the world: those who understand binary and those who dont. ]--
|
|
|
|
|
iv created a UserControl with in it iv made a Property with a get and set. If i create it with a return type and input type of an Integer i can modify the property from the property window . . however this is a problem becuase the value that could be inputed could be eather a string or an integer.
Thefore i made it so that the value to be input and returned would be an object. Hoever when i came to look at the property window i was unable to change the value becuase it is now an object i assume. is there any way around this plz, apart from creating 2 propertys. the code below is what iv done.
Thanks for any help that any one can give
Scott
<br />
<br />
Public Property NumberToDisplay() As Object<br />
<br />
Set(ByVal Number As Object)<br />
<br />
If TypeOf Number Is Integer Then<br />
<br />
If (Number < 0) Or (Number > 9) Then<br />
<br />
sErrormessage = "Recived number out side of range of 0 to 9"<br />
RaiseEvent ErrorOccourd(sErrormessage)<br />
<br />
Else<br />
<br />
iNumberToBeDisplayed = Number<br />
Me.Invalidate()<br />
<br />
End If<br />
<br />
ElseIf TypeOf Number Is String Then<br />
<br />
'if Number can not be converted to a string an error will occour<br />
'e.g. inputing a "."<br />
Try<br />
<br />
Dim iNumber As Integer<br />
iNumber = Int32.Parse(Number)<br />
<br />
If (iNumber < 0) Or (iNumber > 9) Then<br />
<br />
sErrormessage = "Recived number out side of range of 0 to 9"<br />
RaiseEvent ErrorOccourd(sErrormessage)<br />
<br />
Else<br />
<br />
iNumberToBeDisplayed = iNumber<br />
Me.Invalidate()<br />
<br />
End If<br />
<br />
Catch ex As Exception<br />
<br />
sErrormessage = "The input value from the string could not be converted to a number"<br />
RaiseEvent ErrorOccourd(sErrormessage)<br />
<br />
End Try<br />
<br />
End If<br />
<br />
<br />
<br />
End Set<br />
<br />
Get<br />
Return iNumberToBeDisplayed<br />
End Get<br />
<br />
End Property<br />
|
|
|
|
|
You could either restrict your Property to String type, since your code handles everything as a number internally, or you could make an overloaded Property, one set for handling a String object and another for handling an Integer object. I'd go with making your property a String if you absolutely had to do string convertion to get an Integer out of it. Personally, if your going to be using the input strictly as an Integer, make the Property an Integer and don't mess with functionality you don't really need.
RageInTheMachine9532
|
|
|
|
|
Dear Friends,
Please write how to convert rtf file into hlp file. Also pls guide me how to call the hlp file in vb project.
looking the response eagerly
Thanks & Regards
Mani
arutperunjothi thaniperungarunai
|
|
|
|
|
On receiving a new mail, I want to capture its handle , so as to read it's subject. this thing should be done on new mail event?
|
|
|
|
|
hi Kiran,
If u want to capture the new mail event ie. u want to capture the event as soon as mail comes to SMTP.
Firslty specify that when you want to capture this event, becuase there are two servers i.e
1. SMTP
2. NNTP
Again, when do you want to capture it? i.e.
1. as soon as mail comes to mail server
2.or as soon as mail comes to your Inbox, ie. in drop directory.
Becuase in the above two senarios, different implementatin is there.
The best way to capture is On The SMTP server itself.
SMTP supports CDO which gives you the interface called ISMTPOnArrival.
So implementing this interface , you can capture the event.
Becuase ISMTPOnArrival interface has a method called OnArrival which gets triggered as soon as new mail comes to the server from anywhere.
If you specify your requirements then may be i can help you little bit.
regard
bharti.
bharti
|
|
|
|
|
Hi, Kiran
Ok so you want to catch the incoming mails for SMTP services.
Basically SMTP allows to write a sink class for its EventDispature to pass the meassages through it.
Event architecure of a SMTP is based on COM.
So firstly you need to understand the event architecture ,and related information is given in msdn.
MSDN Home > MSDN Library > Messaging and Collaboration > SMTP Server
so go through it.It will help you alot in implementing ISMTPOnArrival interface which i have mentioned in my first reply.
This is a vast concept, so i will suggest you to go through it first , even if u find any difficulty in that itself or in implementation, i can help yoy out. But it is very necessary to go through these articals before jumping on implementation.
Following are two URLs , please go through it.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/ref_mb_smtpserver.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/ref_mb_smtpserver.asp
regards,
Ms.bharti
|
|
|
|
|
How can we create Matrix Reports in Visual Basic 6.0
using Data Reports dynamicallty
|
|
|
|
|
please explain more clearly
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hello, guys...
Part of our fourth year curriculum is the System Analysis and Design wherein we will be creating our own systems, e.g. an enrollment system of a certain school and most of the systems created by past fourth year students were the same like payroll systems, registrations systems, elections systems, etc. Can you suggests some systems in the VB.Net language that are different and new?
Thank you...
len_ems
|
|
|
|
|
I basically have three problems here. First I have created a Calculator but it uses error handlers. I have searched to find codes to create a overflow exception code and underflow exception but found no luck. What I want to do is create an overflow and underflow code so that if the interger is over or under the input then it will bypass the following message:
"Unhandled exception of type "System.Overflow" occurred in microsoft.visualbasic.dll"
And the same for the underflow exception error too.
The last problem I need help on is creating another code so that if the user inputs 1.1.1.1 then an error message will occur. The user is only allowed to enter one decimal point and if the user inputs more than one in the text field then I would like an error message to appear. I know how to create an error message but don't know what code to use if there is more than one decimal inputted. I would also like all the codes to use the Try/Catch statements.
Can anyone help me? Thanks in advance
|
|
|
|
|
justmeTW wrote:
What I want to do is create an overflow and underflow code so that if the interger is over or under the input then it will bypass the following message:
Use catch statements that target the System.OverflowException class to display a personalized message on overflow errors.
justmeTW wrote:
if the user inputs 1.1.1.1 then an error message will occur.
I would suggest using an extended textobx control that would validate user input instead of using try/catch clauses.
|
|
|
|
|
So to use the try/catch for the over/underflow the code should be something like this:
Try
myAnswer = myNumber1 / myNumber2
MessageBox.Show(msg1, "Invalid format")
Catch ex1 as System.OverflowException
msg1 = "Error: Invalid Arguement," & vbCrLt _
& ex1.message
End Try
Is this what I would use to bypass the overflow and underflow error exception?
apferreira wrote:
I would suggest using an extended textobx control that would validate user input instead of using try/catch clauses.
Can you go a little more into depth? And if possible an example code. If I see the code I understand more. Thanks so much for the help
|
|
|
|
|
The MessageBox.Show method should be inside the catch statament, i.e.
Try<br />
<br />
var1=number1/number2<br />
<br />
Catch e As System.OverflowException <br />
<br />
MessageBox.Show("Error:Invalid Argument" & e.Message","Invalid format")<br />
<br />
End Try
As for the extended textbox control that validates user input, I suggest you read the following CodeProject articles:
Validating TextBoxControls[^]
Validating TextBox[^]
And for a more general view on custom control development, I suggest the following MSDN article
Developing Custom Windows Controls using Visual Basic NET[^]
|
|
|
|
|
I need help I am doing a Two-Dimensional array and have to report back the windchill. In the project a table is given and in the table we are to see the Wind Velocity and temperature and see the number assigned to it. I know this is probably simple but I can't figure out what should go in the Private Function section of my code. If anyone can help me I would appreciate it.
|
|
|
|
|
could you paste some of your code for more specific detail?
------------------------
Jordan.
III
|
|
|
|
|
If you can help please do, I'm about to have a fit over this small but annoying issue.
I have an image of a solar system, with 15 images that I need to "create hot spots" for. So that when the user clicks them they "do an activity".
I can't find any reference anywhere as to how to create "hot spots". I've been reading and serching but to no avial. I'm coming along nicely with my project so far, but have stumbled over this part..
Can you help ?
Many thanks.
|
|
|
|
|
You don't make "hot spots" in the images. You track the mouse inside your control and then, when the user clicks the mouse, you compare the mouse coordinates to your objects coordinates.
See this[^] article for an example.
RageInTheMachine9532
|
|
|
|
|
Thankyou for this...
I will read and try this, sounds like the correct way to go.
CoopsQC
|
|
|
|
|
the quickest way to do this i think would be to place objects ontop of your image.
have your main big image in the background, and place (ie.)labels ontop of the main image. make the label transparent so the user doesnt know its there. this label can act as your "hot spot". and upon clicking the label it will act just like a normal hotspot, assuming the coding is correct.
if a label doesnt work, use a imagebox or something, with no border or image source.
------------------------
Jordan.
III
|
|
|
|
|
Thanks Jordan,
I was working on this method as a last way out as it makes the screen somewhat slow to redraw, causing a flicker as the screen redraws the invisible lables on top of the image.
CoopsQC
|
|
|
|
|
I was wondering how you shutdown the system through code.
|
|
|
|