Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IP adress field with mask and AnsiString output 1

Status
Not open for further replies.

McGregor80

Programmer
May 15, 2005
13
PL
How should i use MaskEdit to input IP adress. I used mask "000.000.000.000" but when i write IP (ex) 10.0.0.5
on output i get then AnsiString " 10. 0. 0. 5"
Prolem is that i don't want those space char becouse when i put this AnsiString to Socket->Host it doesn't interprete it correctly.

How should I use it?

Maybe i should use different component to get IP adress?

Thanks for help
 
I'm trying to remember what mask does what. What happens when you use 999.999.999.999 as a mask?

Personally, I've never liked the masked edit components. I've always used the string edit and created a function that will mask the entry for me.



James P. Cottingham
-----------------------------------------
[sup]To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.[/sup]
 
Actually, I resolved similar issue by rather tokenizing the string with dot as separator and checking whether each substring is an integer within the range.
Simplest way I can think of is using four TEdit components, one for each IP segment, StrToInt each of them, check whether they are greater than zero and less than 256, and if the tests are succesful concatenate them into single IP.

I wrote a very simple class for IP handling, using AnsiString as constructor parameter, unfortunately can't find the code now. I'll try to find it and post tomorrow.

Mike
 
2ffat
When i use 999.999.999.999 it's the same.

Paskuda
Think that's good solution(not the easyiest but at the moment i don't know better one). Shame that borland didn't think about that when they included sockets to their component list.
How Do You menage with polish keys on BCB6?

Dzi?ki
 
Start regedit.exe, go to HKEY_CURRENT_USER/Software/Borland/C++Builder/6.0/Editor/Options and set NoCtrlAltKeys to 1. Restart application. That should be enough, Polish diacritics work fine for me, but I set it up long ago, so I may be missing something in my answer. Let me know.

Mike
 
Mike. There is no such key under this set. Atleast not under w98.

????

Gregor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top