Allow textbox to use just alphabetic characters - textbox

Well i m working on my project that is a car parts program in visual basic,i want to protect my textbox in the clients when the user insert a client i dont want the name allow numbers just strings how can i do that?
Thanks

you can try something like this
you can check the text ie TextBox2.Text to make sure it has nothing besides alphabet characters in the content using regular expression
Private Sub TextBox2_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.Leave
If Not Regex.Match(TextBox2.Text, "^[a-z]*$", RegexOptions.IgnoreCase).Success Then
MsgBox("Please enter alphabetic text only.")
TextBox2.Focus()
End If
End Sub

Related

Looking to fill out most or all of the Fed Ex "Create Label" page using URL query string

Looking to create a shipment on www.fedex.com
But fill out most of the fields using a query string at the end of a URL.
Seems like this might not be possible, but need help figuring out how to know whether it is or not.
My "Create Labels" page has a URL ending in -- ?method=doInitialize&utype=null ,
or else sometimes ...
-- ?method=doEntry&link=1&locale=en_US&urlparams=us&sType=F
so it seems promising. Just not sure how to access the names of the required fields (Contact name, Address 1 and 2, etc ) besides guess and check.
Thanks!
--------- Destination Section Parameters Found
The query string parameters for the destination contact field are, at the time this answer was written :
toData.addressData.contactName
toData.addressData.addressLine1
toData.addressData.addressLine2
toData.addressData.zipPostalCode
toData.addressData.city
toData.addressData.stateProvinceCode
toData.addressData.phoneNumber
psdData.mpsRowDataList[0].weight
Of course, they need to be appended to the original URL using valid query string syntax and URL encoding.
--------- How Were These Found ?
These were each found using the page inspector. I found that it is important to cut through the noise by zeroing in on the exact field where the data needs to be entered, and opening up the page inspector to that location.
Right click (Win) or control click (Mac) > "inspect"
This will bring up the following text in the inspector. By trial and error, I discovered that the "name" fields correspond to the working query string parameters.
The part we are looking for :
This corresponds to the query string parameter ...
toData.addressData.addressLine1
... originally listed above.
--------- Unsolved Parameters
It's a mystery why this same rule doesn't apply in the same way to other values in the page, like service type (e.g. "Priority Overnight") or package type (e.g. "FedEx Box"). The following, for example, do not fill as expected, even when using the exact same "name" field from the page inspector.
psdData.mpsRowDataList[0].carriageValue
psdData.serviceType
psdData.packageType
billingData.referenceData.yourReference
Maybe it's a URL encoding issue? Anyway, hope this helps.

how to locate a hyperlink field

I have an access 2010 table with a hyperlink field where i store the E-Mail adress of clients. Before I add a new E-Mail I want to check if the E-Mail address is already there. I try to use a locate statement like (delphi 2009; adoconnection, TADOdataset):
if table.locate('ML_Link',NewAdress,[locaseinsensitive]) then
This statement gives an error message with something like that the sequence is not allowed.
How can I search for hyperlink fields?
I suspect that the # character is considered a special character. I suggest you try splitting the address into two parts, email and domain for example, then search both fields as
if table.locate('email;domain', VarArrayOf([NewEmail, NewDomain]), [locaseinsensitive]);
You may also need to add variants to your uses clause, depending on your delphi version..

How to reference a string of text then hyperlink it to a url?

My problem is i need a bit of code to reference a tracking number eg 1193849302, and insert it into a url http://www.example.com/track=[tracking number], so that the [tracking number] is replaced by 1193849302
then to have showing only the tracking number which is hyperlinked to said URL, i.e. 1193849302 (hyperlinked)
Either in html or javascript I think most of the site is CSS based though
Is this possible?
Thanks in advance
Edit maybe i should explain what i want a bit better
I have a customer area on a retail website , which returns the customers parcels tracking number when despatched.
What i'm after is a way to turn this tracking number into a working hyperlink which when clicked opens a new window into the couriers website automatically pushing the tracking number into the url and tracking the parcel for them.
Does this sound possible??
Most languages have a String.replace function.
For example, in Javascript, use replace() for this. Note that it takes a regex as an argument, so the [] need to be escaped:
var str = "http://www.example.com/track=[tracking number]";
str = str.replace("\[tracking number\]", "1193849302");
use String.replace method
The replace() method searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced.
var str="http://www.example.com/track=[tracking number]";
var n=str.replace("tracking number","1193849302");
You can find more informations at http://www.w3schools.com/jsref/jsref_replace.asp

Asp.Net MVC: Client data validation in double, with localization

I've a small problem with my Asp.Net MVC.
For now I've developed a website in english, everything is working fine, all my texts are already in localization, and I've already a session based system. When I go to another language(in my case french), it changes the Thread.CurrentThread.CurrentUICulture and Thread.CurrentThread.CurrentCulture to a culture info created from "fr".
All my traductions is working, but I've a problem in one form.
In France, the decimal part is separated from the integer part with ",". The server validation works fine with it and translate "234,512"(and know transforms "234.512" too)into a double.
But the client validation doesn't accept this, it says:
"Le champ XYZ doit ĂȘtre un nombre."
So it has the correct local(because the message is translated in french), but it seems to want the number edited in "235,55".
At start I thought it wasn't a big deal, users can enter number with the "234.512" format, but the problem is for the edition of data, since the thread is in French, it fill the model with "234,512", and not "234.512", and because of that customer must change the separator on every change(event if they don't make change on this field) otherwise they get a client validation error(no call are being made when I press on the submit button, I checked several times).
So what should I do to have the client validation script for double working in the current locale?
Thank you very much!
It seems to be a problem with the jquery.validate.js (or jquery.validate.unobtrusive.js), which only accepts dots as separators.
Take a look on the following post for a solution:
http://www.mfranc.com/2011/07/05/jquery-valdiator-modyfing-decimal-separator/
or
http://www.campusmvp.net/asp-net-mvc-3-and-the-coma-in-decimals/
It is known problem. Javascript validators inside jquery doesn't allow anything except point.
The simplest way is to change jquery.validate.min.js (or so) or override custom validator inside your cshtml. Inside jquery it will be:
// http://docs.jquery.com/Plugins/Validation/Methods/number
number: function(value, element) {
//return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value); <-- original
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:[\.,]\d+)?$/.test(value);
},

special character coming when i am using & and p

I dont know what exactly i have to type in title for this ,i tried my best
anyway coming to topic
I am making one acc checker for that purpose ,i am sending user and pass from my bsskinedit1 and bsskinedit2
here is my code
s:='http:\\site.com..premlogin='+bsskinedit.text+'&password='+bsskinedit2.text
but it giving some error ,then i used showmessage whats wrong with it then i came with strange result
see below
observer after 4 & and p combining together and appearing as a some new symbol :(
can any one tell me why its coming like this ?
Your code (where you build the URL) is most likely correct (I guess the above has some typos?!), but when you display the URL in a label for instance, the & character is treated as indicator for an accelerator key.
By Windows design, accelerator keys
enable the user to access a menu
command from the keyboard by pressing
Alt along the appropriate letter,
indicated in your code by the
preceding ampersand (&). The character
after the and sign (&) appears
underlined in the menu.
If you want to display the & character itself, you have to set your string variable to &&.
By placing two ampesands together - you state that the character following the first one is not used as the accelerator - rather you actually want to get it (only one) displayed.
Just use your debugger if you want to see the real value that your string variables have, don't output them to a message box or the like... It may have side effects, as you can see.
Regarding the URL you build: I can't possibly know how it has to be correctly, but at least you should use the right slashes!
s := 'http://site.com...'
(All quotes from delphi.about.com)
In addition to what Mef said, you can use OutputDebugString to add your string to the event log in its raw form, so you don't need to modify it before displaying it. Delphi should capture those strings automatically if you're running from the debugger. If you aren't running it from Delphi you can use DebugView instead, which captures the messages from any running applications.

Resources