When Was Isnumeric Considered Legacy Code
Jan 3, 2012When was isnumeric considered legacy code? I guess all that i have learned from my college class last semister is legacy.
View 4 RepliesWhen was isnumeric considered legacy code? I guess all that i have learned from my college class last semister is legacy.
View 4 RepliesI want to change the IsNumeric to string in the code below but IsString gives an error how can i go round it Private Sub txtprojtypenw_Validating(ByVal sender As Object, ByVal e As
[Code]...
Public Const COLUMN_MODEL_ORDER As String = MDL_ORDER.ColumnName
DataModel.Config.DefaultView is a System.Data.DataView
how can I convert it?:
Dim ModelOrder As Integer = 1
Dim DataModel As New ProfileDataModel(New DBConnection, Me.ProfileID)
If DataModel.Config.DefaultView.Count > 0 Then
[code]....
I'm building an c# app that is designed to replicate and enhance the functionality of an VB6 app developed many years ago. My problem is that one module in the old app does some realy complicated things and trying to replicate this starting from specs would be a big pain for me. Even if this sounds like the best idea.
My question is : is there a way i could keep the old VB module and integrate it into the c# app, so that i wouldn't have to rewrite everything ?
I have an old application in BASIC. It still runs under Windows ME. It no longer works under XP, so I was looking at recoding the applciation. I started coding it in VBA, which I have used for Excel macros for years.
We are looking at getting a new computer for kids to use for schoolwork, etc. I also want the kids to learn programming and recoding my old BASIC application is a good place to start. A new computer we were considering has MS Works, but I suspect I will need MS Office (at least Excel) to get VBA. There are multiple versions of Office 2007 (Home & School, Small Business, Pro), so I looked into the Microsoft website to see if I could find out what version of Office I need to get to have VBA. What I found is that VBA seems to be going away in favor of VSTA and VSTO.
Is VBA truely going away? Or is it still going to be a part of Excel for wrting macros? If VBA is part of Excel, is it available in all versions of Office? If VBA is going away, what is recommended for recoding my old BASIC application?
The application involves display of a screen full of data with color coding and has several actions for updating those data.It does not involve any graphics or animation. In the old BASIC application all the system data and runtime data are in program variables.
The actions to be performed are selected by number from menus.In creating the application in VBA, I envisioned primary data display on a main form, which would also have buttons to invoke dialog panels to perform the various updating actions.I have the system data that are not changed when the application is run in one Excel worksheet and the runtime data on another worksheet.
I'm converting a project from .net 1.1 to 3.5, and everywhere the following is used in the markup:
Design_Time_Lock: true
e.g.
<asp:linkbutton id="lbRun" style="Z-INDEX: 111; Design_Time_Lock: True" runat="server">Run</asp:linkbutton>
[Code]....
I've read up about the Design_Time_Lock attribute, and I can see when it will and won't be generated. However I don't really understand the point of it. And- more importantly- can all instances of it be safely removed throughout the code?
During the design of a new application I was wondering if using a module with properties is considered to be a bad practice. Some example code:
Module modSettings
public property Setting1 as string
public property DatabaseObject as IDatabaseObject
End Module
The code above is just an example to emphasize my question. In the past, this structure was used a lot in VB6. In the past I used it as well in my .NET projects.
But nowadays with buzzwords like Dependency Injection, Testability and Separation of Concerns the above structure smells bad. I can't really describe why, but it just feels wrong. I must admit I'm not very familiar with the keywords above, yet.So I'm wondering whether the above code really is a bad practice. If so, what would you use a Module for?
VB.NET has classes and Modules, so my first question is what is the difference? Also, I noticed that C# does not have modules, but just classes, is there something in place of modules or were they removed for C#?
View 1 RepliesYou need to test for the backspace character, and if it's there, fix up the input.Maybe something like this:
If Right$(TxtQP.Text, 1) = vbBs Then
TxtQP = Left$(TxtQP, len(TxtQP)-1)
End If
Or is the backspace not showing up in the string, but as the input character kicking off your procedure?
I use to use Structures quite a lot in the VB6 days, and try to avoid them now with .NET. Just wondering if using structures in 2010 instead of a Class is considered nasty?
View 6 Replieswhich one cannot be considered as a counter variable?
counter = counter +1
counter = counter -1
counter = counter +3
counter = counter *2
I'm just wondering why using GoTo<label> is so frowned upon?I'm learning VB, and I want to develop good habits as I go. One thing I don't entirely understand, is why everyone avoids GoTo like its the plague (except in error handling...). I feel like GoTo could be useful in some situations.
View 1 RepliesWhy after you pressed the button Button1, this application crashes without considering the event timer1??
Public Class Form1
Public timer_event As Boolean
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
timer_event = False
Timer1.Interval = 3000 '3 sec
[Code] .....
Ever since I started using VB.Net I have been using the Generic List collection List(Of <Type>). Arrays, I haven't used so much. I used them a lot more when I wrote C code years ago.
1.) Are arrays considered a type of collection like Lists, Dictionary, Queue etc are? Or are they in their own category.
2.) Can I iterate over an array with a For Each loop like I can with other collections or do I stick with the normal For loop for arrays?
3.) There are certain methods that return arrays. Can I set a list object to hold this return value instead of an array?
I currently have this line of code which has been working for the past 6 months:
If IsNumeric(txtProductID.Text) Then
...do stuff
Else
Dim msg As String = "Error!"
End If
All of the sudden, no matter what kind of entry is put in txtProductID (including plain numbers), it fails! Is there reason for me to be going crazy over this?
What is the C# equivalent function of IsNumeric() in VB.. If possible include an example.
View 4 RepliesI have a function in VB.NET that loops through values and attempts to convert it to a decimal if IsNumeric is True,
Dim Value As String
If IsNumeric(Value) = True Then
Rate = CType(Value, Decimal) <--- bombing here
End If
I've found that when the function receives the value 603E43 IsNumeric evaluates to True for some reason and then bombs on the conversion. Why would IsNumeric be true in this case?
I have VS2005 and I'm trying to use a function like isNumeric, except it accepts an array of strings.
[Code]...
I keep getting errors, anybody know why? Might just be a stupid mistake, haha its been a long day today.
Public Class Form1
Private Sub Button1cmdRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1cmdRun.Click
Dim hour As Integer
Dim minute As Integer
Dim second As Integer
[Code]...
Whenever I run the program and I enter text into the label the program crashes. When I type in a negative number the message box works. A number like -45 worked and a message show appeared, whilst a string like 'bob made the program crashed.
I have a list of color values encoded as signed integers (OLE I think) in a legacy INI file that I need to translate into (A)RGB values with .NET. [code]...
gives an alpha-blended version of a color that is not at all what I expect. I think that a value like -2147483633 is supposed to represent a system-defined, or named color like ButtonFace. Is there a .NET method for translating these legacy colors properly? Note that pInvoke to OlePro32.dll is not an option.
I'm working with visual studio 2008 developing software for windows CE 6.0, compact framework.I'm having this "strange?" trouble with isNumeric method. Is there another better way to do this job? Why is getting me an exception? (two in facts...both of type FormatException)
dim tmpStr as object = "Hello"
if isNumeric(tmpStr) then // EXCEPTIONs on this line
// It's a number
else
// it's a string
end if
Following a recomendation from an expert, I removed the Microsoft.VisualBasic Reference from my project in order to "clean" the code and use only .NET. Almost anything I have been able to fix except I cant find the equivalent of IsNumeric or IsDate functions.
View 13 RepliesI have some customized string formats of double values. I need to convert these strings to double values at some point (Note that these strings may contain error messages other than numbers). So I first check if these strings are numbers, and if yes, then convert them to double. Isnumeric works for my first customized string format. But I found that is numeric cannot recognize percentage strings. I wonder why isnumeric understands () but cannot understand %. And what is the better way to convert "(100.00)" and "50%" to doubles other than Cdbl?
[Code]...
I had a strange error in a VB6 app this morning and it all stems from the fact that IsNumeric is not working as I expected. To me this seems like a bug.
This code displays 4.15877E+62 in a message box:
Dim strMessage As String
strMessage = "0415877D57"
If IsNumeric(strMessage) Then
[Code]....
I am guessing that the runtime engine is incorrectly thinking that the D is in fact an E? I think this is a bug though as the exact same code in VB.NET outputs not numeric Is this a known issue with IsNumeric?
On all my assignments I am asked to make sure the data is valid - only numeric, no empty strings. And I keep wondering which is the best to use IsNumeric or TryParse. When I try both on coding they seem to do the same thing, and I don't seem to find my answer online. Any ideas of why to use one over the other.
View 3 RepliesPrivate Sub Bearing_Textbox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Bearing_Textbox.KeyDown
If e.KeyCode = Keys.Enter Then
e.SuppressKeyPress = True
Call Plot()
[Code] .....
Which is used to plot bearings. The user inputs a bearing of 0-360 degrees. It works fine if a user say types in "abc" or "/" i.e. anything that isn't numeric. But if a user types in "90/" then it allows it. When the bearing is plotted the keypress is surpressed so the user cant then go back an edit. Is there a quick way to amend the code to allow for this?
Whats the best way to add an adornment layer to legacy controls, or in other words you know jetbrains refactoring tools, how do they draw the squiggly lines under incorrect text? Also on another note can one draw said adorments on controls not under the direct reference of the application, ie using a handle? If you have insights, or just theories,
View 1 RepliesI am looking for a utility/tool to convert calls to legacy VB6 functions to the .NET equivalent. For example, it would convert this...
[Code]....
Does anybody know of one, or am I going to have to roll my own?
I need to create a DLL that's callable from C, that executes database queries and returns results. The first tool I reached for was VB, and I found it easy to create a DLL, but when I view the DLL using dumpbin /exports, I don't see any functions.
So, my questions:
1) Is VB the right tool for the job? If not, (The ideal solution would be a 3rd-party DLL that will let me do database queries -- a friendly higher-level wrapper above ODBC. I've searched around and come up empty, but maybe I haven't looked in the right place).
2) If VB is the right tool for the job, how do I export a class method so that it's callable as a function in a legacy C environment?
More details:
1) The target environment is Mercury Loadrunner VUGen. It's able to import DLLs and make function calls, but the environment is (non-.NET) legacy C.
2) My development environment is MS Visual Studio 2008
Hint: this one might sound complicated, because I am trying to give as much info as possible, but I suspect that I just want someone to tell me "yes, you are correct".On this legacy system, which dates from 2002, the user visits a web page and uses an RFID reader to read a tag number, which is then written to an input field on the web page.
The only s/w that comes with the reader is a custom DLL, nop .exe. The very sparse documentation insists that only MSIE be used and that all security relating to ActiveX be disabled.When I look into the source of the web page I see calls to functions in the DLL.Now, here's the fun part: I know zilch about ActiveX, I have to make a minor change to the DLL _but_ the VB6 source code has been lost, so I guess that I have to recreate the (seemingly very simple) DLL from scratch - this week.
Decompiling the DLL shows me the functions (locateReader, getTagVal, closeReader). However, by decompiling I can't really know the number or type of the parameters, nor the return values ... and if anyone knows the API they are refusing to share it, but basically it all seems to have been lost in the mists of time as companies went bust, were bought & sold, merged & demerged and the initial DLL might have been written by an external guy, but no one knows who.So, can I get the function params & type from the ASP page source?I see things like
Reader = new ActiveXObject("<dllName>.Reader");
Reader.locateReader();
tagVal = Reader.getTagVal();
Reader.closeReader();
I would say that none of the fn()s take parameters, that closeReader doesn't have to return anything; it looks like locateReader doesn't return anything either, so I guess that error handling will have to be in the DLL (loop forever with a popup demanding that a reader be attached; and getTagVal seems to return a string.