|
What environment are you using, Web or Windows?
A MaskedEdit textbox will work.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Windows, but I think that I found solution...
Thank you!
P.S. If I have some errors, I am sorry my English is bad...
|
|
|
|
|
In Visual Basic there is a method, IsNumeric, to test whether a textbox contains a value that can be converted to a number; C# has no such method. C# does, however, include the type Decimal, which includes a Parse method. The C# Parse method will attempt to convert the text passed to it into a Decimal type, returning the Decimal value or a FormatException error. See this article[^] for information about the Decimal.Parse method.
The advantage of the Decimal type is that it can represent both integer and floating point types. You could test for all the possible real and integer types supported by C#, but that would be tedious and it's unlikely that a user will be typing an entry in a textbox large enough to require one of the more esoteric types possible. It can also be cast into other numeric types easily without loss of accuracy due to rounding errors.
If you are really trying to create a User Control containing textboxes, rather than just a textbox on a form, you can save some time by creating just one method in your control to test the validity of the input text and call it for each of your control's textboxes. That's the approach I took in [insert shameless self-promotion disclaimer] this article[^] about my first User Control. In the ValidateEntry() method, called by all of the textboxes on the User Control, I use Double.Parse() to check the values entered by the user. I don't expect any entries with integer values, so I used Double.Parse, but for your use, Decimal.Parse() is a better choice.
The MSDN article referenced above provides sample code for testing the value in VB and C#, and the samples simply display an error message if the Parse method fails. You'll probably want to do something more useful with your code. In my first User Control project, I displayed a message, set the return value to an unlikely result, then used that result to return focus to the textbox that contains the faulty data. You might want to do something else, as appropriate for your application. It's unfortunate that we don't have a method available in either language to deliver a strong electric shock to a thumb-fingered user via the keyboard but, alas, it's not a perfect world.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
You mean like a NumericUpDown?
|
|
|
|
|
We have set of applications developed in .Net Framework 2.0 (both Windows and Web Applications) running in Windows 2003 Server. Now management decided to upgrade it to Windows 2008 Server. Any changes required in Application side?. If not, those applications work with full potential of windows 2008 server ?
Thanks in advance
|
|
|
|
|
No changes should be necessary as long as the proper framework is installed and you are not using a methods that may have been depreciated (can't think of any). Bottom line is you need to do testing.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks for your answer and suggestion.
Still has one doubt, Will those applications run without any issue in 64bit mode of win2008 or Win2008 R2 ?
[applications are compiled with 'AnyCPU' option]
|
|
|
|
|
Noone is able to say since they didn't write the code and have no idea what it's doing or using.
If your code uses components that at 32-bit, you're going to have problems. If not, then you might not.
The only way to tell is to setup an environment to test in and thoroughly test your applications before you try to put it into production.
|
|
|
|
|
Hello, how is everyone today.
I wanted to ask how to add a registration form that can appear at the end of an installation process for a windows application.
I used the built in setup process in VS 2005.
If I was not as specific, I can elaborate in more detail.
|
|
|
|
|
There are custom build actions you can add. From here you can launch forms, perform setup etc.
|
|
|
|
|
Hi!
I am using this BackTrack procedure that Fills a map.
Private Sub Fill(ByVal i As Integer, ByVal j As Integer)
If (i < 1) Or (j < 1) Or (i > FillM.Width) Or (j > FillM.Height) Then
Exit Sub
End If
If FillM.Pixel(i, j) = 1 Then
FillM.Pixel(i, j) = -1
Fill(i, j - 1)
Fill(i, j + 1)
Fill(i - 1, j - 1)
Fill(i - 1, j)
Fill(i - 1, j + 1)
Fill(i + 1, j)
Fill(i + 1, j - 1)
Fill(i + 1, j + 1)
End If
End Sub
When The Map has a few pixels that have value 1, It works correctly. but when the map has many pixels that has value 1, It cause an StackOverflowException. How Can I resolve this problem and why .Net Framework 3.5 throw this invalid Exception????
Regards.
Mehdi Ghiasi
|
|
|
|
|
Mehdi Ghiasi wrote: why .Net Framework 3.5 throw this invalid Exception
There probably isn't anything invalid here, your algorithm is such that a lot of recursion may occur.
Here is an example: assume an N*N map, all elements are -1 except for row 2, there they are all +1.
Now somehow you start at (2,N-1), the rightmost +1. Your Fill will call Fill(i, j - 1), which is +1 again, so it calls Fill(i, j - 1) which is +1 again, etc. You are basically pushing all elements of that row onto the stack, resulting in a nesting of N and that has used one dimension only.
There will be patterns that put big chunks of your N*N map on the stack, therefore it is either a bad algorithm or a bad implementation. A better algorithm would perform more work in the function itself, resulting in fewer stack pushes. You really need a stack push only when there are multiple ways to go and you can proceed on only one of them right away, then the others need pushed somehow. But then, a width first approach would be better than a depth first one.
Have a look at the "A* algorithm", or search for flood fill.
|
|
|
|
|
It may be interesting and illustrative to adapt the algorithm to use a queue rather than a stack. If you do that, you will observe the behavior looks as though the filled area "spreads". People who remember BASICA from way back when may recognize the queue-fill behavior as being something like what BASICA did, except that it scanned horizontal line segments directly rather than enqueueing each pixel thereon.
Note that the total number of queue entries required will be proportional to the smaller dimension of the area being filled, whereas a stack-based implementation will require stack depth proportional to the number of pixels.
|
|
|
|
|
|
Hi,
I have a problem with HTML code interpretation in Crystal Report Basic report when exporting it to pdf, each text object has the Text interpretation Setting set to HTML, but the text is not rendering as HTML and still looks like plain text, I know for sure that problem is not in *.rpt file
(for example, when exporting this report using CR 10 it works well), but with report engine.
Just wanted to ask is that the limitation of Crystal Report Basic for Visual Studio 2008?
Thanks in advance
|
|
|
|
|
I have an ActiveX control for web created in .net 3.5. When upgrading the framework to 4.0 it stops working. I have tried to create a hello world activeX control with 4.0 and it wouldn't work either. Is it not possible to create ActiveX controls with .net framework 4.0? I have also tried to create windows form control for web but again it doesn't work.
|
|
|
|
|
awu25 wrote: I have also tried to create windows form control for web but again it doesn't work.
Of course it doesn't work why would you expect it to.
ActiveX has been depreciated for several years, its time to update.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I have also tried to use Windows Form control but still doesn't work. If both of them are obsolete what should I use to get client printer information through browser in an intranet environment?
|
|
|
|
|
Windows controls are not obsolete. You can't use Windows controls in a Web environment
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I meant windows form control and it actually does work with web environment. I can get it to work with .net framework 3.5 or earlier, but not .net framework 4, not even a simple hello world control.
What are my choices? I am willing to try anything.
|
|
|
|
|
You shouldn't actually run a .NET windows control in a web page - this would place a requirement on the end user having the correct version of .NET installed.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
They aren't really obsolete - they've been deprecated, but you can still write ActiveX controls in C++. Can you say "Ouch"...
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
awu25 wrote: ActiveX control for web created in .net 3.5
No you don't. None of the managed code compilers target building an ActiveX control. You can build something that exposes interfaces through COM, but it's not an "ActiveX control".
|
|
|
|
|
Hi all,
I'm attempting to load an xml document from an XML column in MSSQL 2008, into an XmlDocument (see code below).
Sometimes the code will break at the <b>xdoc.Load(xr)</b> line with the error "Unexpected end of file and occurred". After breaking, the XmlReader has a value of "None".
While researching the problem, I saw posts that referred to a 4Kb limit on StreamReaders and figured this may be related somehow. So I cut down the size of my document (to around 4Kb) and everything worked fine.
On average, the XML documents I'm importing from the database are 20Kb and thanks to validation on INSERT by MSSQL, we can assume(?) the document is well-formed.
Does anyone know how to get 'large' amounts of XML from the database into my XmlDocument?
Dim xr As XmlReader = ExportAdapter.GetEditedCheckXML(chkId)
Dim xdoc As New XmlDocument
xdoc.Load(xr)
Here's the GetEditedCheck fn:
Public Shared Function GetEditedCheckXML(ByVal checkId As Integer) As XmlReader
Dim conn As SqlConnection = New SqlConnection(CONNECTION_STRING)
Dim comm As New SqlCommand("PS_GetModifiedXmlByCheckId", conn)
Dim adap As New SqlDataAdapter
comm.CommandType = CommandType.StoredProcedure
comm.Parameters.Add("@checkId", SqlDbType.Int).Value = CInt(checkId)
conn.Open()
Dim xml = comm.ExecuteXmlReader()
xml.Read()
conn.Close()
Return xml
End Function
|
|
|
|
|
Dear all,
Please help me ...
I want to add two datatable in dataset. I did as below code. when adatapter fill to 2nd table. It fill with first query statement.
So both table get same result.
Want to know how to get different result.
Dim acon As New SqlConnection(ConfigurationManager.ConnectionStrings("DOCDBDWHConnectionString").ConnectionString)
Dim acmd As New SqlCommand()
Dim sSql As String
acon.Open()
sSql = "select distinct vessel_code,vessel_desc from D4A_RAW_BLP"
acmd.Connection = acon
acmd.CommandText = sSql
'Pull vessel code
Dim dataset As New DataSet
Dim adpvsl As New SqlDataAdapter
Dim adpvoy As New SqlDataAdapter
adpvsl.SelectCommand = acmd
adpvsl.Fill(dataset, "Vessel")
'Pull voyageno
sSql = ""
sSql = "select distinct voyage_no,vessel_code from D4A_RAW_BLP where vessel_code in (select distinct vessel_code from D4A_RAW_BLP where vessel_code<>'') order by vessel_code"
adpvoy.Fill(dataset, "voyage")
Thanks and best Regards
|
|
|
|