|
OK, well, perhaps you need to write a single, intelligent post that actually outlines what you have done, instead of posting the same vague question over and over ? If what you want to do, occurs on the client side, then it's not going to work in ASP.NET, because the server code is on the server, not on the client.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
One Post is enough.
WHy are you again and again posting the same question.
there itself CG has answered you.
Regards,
Satips.
|
|
|
|
|
Got to love it when instead of taking your advice, they just delete all their posts.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You're mixing types in a horrible way.
BTW, since tot is an Integer , it cannot store a floating point value.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
so what should i do to store float numbers
|
|
|
|
|
Use a float, decimal, or double. The questions you're asking, and the code you're posting, indicate that you should slow down, buy a basic book on VB.NET, and work through it. You should certainly be aware of the horror of VBs loose typing, and be aware of when you're relying on it to make your code work, it can create all sorts of hidden bugs and side effects.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want to validate that my textbox contains a numerical value.
I do this in the "textbox.validating" event, everything works fine until all the text is cleared and the box has an empty string. The validation doesn't allow an empty string because it's not numerical (no matter how I code it). But this field is not compulsory for the user to enter, so he should be able to enter either a numerical value or an empty string.
Here is my code so far, it doesn't work for empty strings, textbox remains invalidated and forces focus onto the control.
Private Sub MyMaskedTextBox_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyMaskedTextBox.Validating
Dim num As Double
If Me.MyMaskedTextBox.Text = "" Or IsDBNull(Me.MyMaskedTextBox.Text) Then
MyErrorProvider.SetError(Me.MyMaskedTextBox, "")
Else
Try
num = Me.MyMaskedTextBox.Text
MyErrorProvider.SetError(Me.MyMaskedTextBox, "")
Catch ex As Exception
MyErrorProvider.SetError(Me.MyMaskedTextBox, "Value must be numeric")
End Try
End If
End Sub
This is a real problem because nothing I've tried so far allows the user to enter an empty string!
Can't I somehow force the field to validate even if the contents don't match the validation criteria?
_______________________________________________________________________
http://www.readytogiveup.com/[ ^]
"you can't forget something you never knew..." M. Du Toit
"Watching Migthy Joe Young made me hate my life..................................I want a gorilla!" A. Havemann
|
|
|
|
|
The following code may be better
if string.isnullorempty(Me.MyMaskedTextBox.Text) orelse isnumeric(Me.MyMaskedTextBox.Text) then
'Its a number or an empty string
else
'Its got content but is not numeric
end if
|
|
|
|
|
Thank you SHatchard but that code does exactly the same as mine.
The textbox still doesn't validate with an empty string and focus is forced to the control until it validates.
_______________________________________________________________________
http://www.readytogiveup.com/[ ^]
"you can't forget something you never knew..." M. Du Toit
"Watching Migthy Joe Young made me hate my life..................................I want a gorilla!" A. Havemann
|
|
|
|
|
This field is databounded to a DB cloumn of the type Double.
It seems that NULL is not accepted by datasets for Double columns.
Eventhough the default value is DBNull (which .Net accepts) and the AllowDBNull property is set to TRUE (which .Net accepts)
The columns NullValue property can only be set to <throw exception="">, .Net rejects all other selections.
I still don't have a solution but this problem starting to look more like a bug in .Net than and not in my code.
_______________________________________________________________________
http://www.readytogiveup.com/[ ^]
"you can't forget something you never knew..." M. Du Toit
"Watching Migthy Joe Young made me hate my life..................................I want a gorilla!" A. Havemann
|
|
|
|
|
try to replace
--If Me.MyMaskedTextBox.Text = "" Or IsDBNull(Me.MyMaskedTextBox.Text) Then
with
--if isnothing(Me.MyMaskedTextBox.Text) then
or
--if Me.MyMaskedTextBox.Text is nothing then
if it still doesnt work... may i know what vb are you using?
|
|
|
|
|
Thank you for the response!
That doesn't work either, I'm using VB .Net in Visual Studio 2005.
That field is data-binded to a dataset, the column's type is Double.
I think that has something to do with it not allowing Nulls.
Funny thing is, it allows NULLS, just not when you try to enter it with the textbox!
_______________________________________________________________________
http://www.readytogiveup.com/[ ^]
"you can't forget something you never knew..." M. Du Toit
|
|
|
|
|
O.k, I found a work-around for the problem. Posting it here for the sake of anyone having similar problems.
What happens that causes the problem is that VS doesn't allow a control (in my case a textbox) to lose focus if the text inside it doesn't validate. But for numerical textboxes it also doesn't validate empty strings, even if you want the user to be able to add an empty string.
The solution is to set the data source update mode to never, this disables .Net validation on the control, allowing you to do this with custom code.
Me.MyNumericTextBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.Never
The validating event still fires though, but it's under YOUR control now, so the following code will allow you to force the user to enter either a numerical value, or an EMPTY STRING.
Private Sub MyNumericTextBox_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyNumericTextBox.Validating
If String.IsNullOrEmpty(Me.MyNumericTextBox.Text) OrElse IsNumeric(Me.MyNumericTextBox.Text) Then
MyErrorProvider.SetError(Me.MyNumericTextBox, "") 'Fire or cancel the
'error in whatever way suites you, this simply clears the errorprovider
Else
MyErrorProvider.SetError(Me.MyNumericTextBox, "The value must be numeric") 'Fire or
'cancel the error in whatever way suites you, this sets the error on the errorprovider
Me.MyNumericTextBox.Focus() 'This forces the user to enter the validated
'data before leaving the control
End If
End Sub
Please reply to this post for more information.
_______________________________________________________________________
http://www.readytogiveup.com/[ ^]
"you can't forget something you never knew..." M. Du Toit
|
|
|
|
|
ASP.NET is irrelevant, you're talking about doing this on the server. I'd look at the Visual Studio Tools for Office, they allow you to manipulate office documents in code.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
i have created one seup application for ne of the company now i want to add Image on the shortcut file which will be created after installing the setup.
So,does anyone knoes how to do this???
GIRISH
|
|
|
|
|
You can set the icon in the setup program, you just have to include the icon image in your setup and then reference the icon in the proper places in the setup project. So you will have the extra icon file when you install your application.
Ben
|
|
|
|
|
To include image Icon
Go to Application Folder and add an icon file there,
and give that path to Desktop or Program Files Reference(give it by Right clicking and selecting icon property)
TO add Icon to Add or Remove programs
press F4(properties)of setup project
the first opetion will be the add icon to addorremove programs one
just select ur icon file
It works for me,
Prashanth
|
|
|
|
|
hi,
Thank you very much for your reply.
GIRISH
|
|
|
|
|
"How to pass value of a variable of one form to the next in vb.net" ( suppose i have a text box in form1 and there is some value , now i want to get back it in the form2 ). I think i have made my problem clear to all . Please send me the code - i need that very badly . Please help me .
Check it out .
|
|
|
|
|
A very simple way (although not the best) is to add a module to your project and declare a public variable in it. This variable will be available to all forms in your app.
Public MyPublicVariable as String
Public Class MyForm1<br />
MyPublicVariable = MyTextBoxOnForm1.Text<br />
End Class<br />
<br />
Public Class MyForm2<br />
MyTextBoxOnForm2.Text = MyPublicVariable<br />
End Class
For example
My advice is free, and you may get what you paid for.
|
|
|
|
|
No, that is just plain super nasty.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
'Declare the form
Dim oFrm as new frmXXX
'Open the form as a dialog and get the result
if FrmXXX.showdialog(me).dialogresult = Ok Then
sText = oFrm.Textbox1.Text
End If
oFrm.Close
Trick is to HIDE the form in the Ok/Cancel buttons
|
|
|
|
|
Yep, that is the better solution
My advice is free, and you may get what you paid for.
|
|
|
|
|
You should never create 'global' variables, if you can avoid it, nor should you ever expose a UI element as public. You should always expose as little as possible, so in this case, expose a property, which is of type string, and have it return or set the Text property of the specific textbox.
Or, if the first form is creating the second, you can force the setting of this property by passing it through the constructor.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
iam using vb2005 and microsoft access as database
making database application
and i made this code in form1 and i need the same code but there was some different in the fields
and when i typed it in form2 it didn't work i don't know why
plz help me it's very urgent
i will appreciate all ur efforts
thanks
|
|
|
|