Click here to Skip to main content
15,908,776 members
Home / Discussions / C#
   

C#

 
QuestionLastIndexOf("") in C# Pin
jayarajmrj8-Aug-07 20:05
jayarajmrj8-Aug-07 20:05 
AnswerRe: LastIndexOf("") in C# Pin
hamid_m8-Aug-07 20:19
hamid_m8-Aug-07 20:19 
AnswerRe: LastIndexOf("") in C# Pin
Vikram A Punathambekar8-Aug-07 21:45
Vikram A Punathambekar8-Aug-07 21:45 
AnswerRe: LastIndexOf("") in C# Pin
Luc Pattyn9-Aug-07 0:57
sitebuilderLuc Pattyn9-Aug-07 0:57 
QuestionWindows Form Pin
sangramkp8-Aug-07 19:37
sangramkp8-Aug-07 19:37 
AnswerRe: Windows Form Pin
Christian Graus8-Aug-07 19:41
protectorChristian Graus8-Aug-07 19:41 
QuestionSwitching between two threads Pin
praveen pandey8-Aug-07 18:48
praveen pandey8-Aug-07 18:48 
AnswerRe: Switching between two threads Pin
Leslie Sanford8-Aug-07 19:41
Leslie Sanford8-Aug-07 19:41 
GeneralRe: Switching between two threads Pin
praveen pandey8-Aug-07 19:55
praveen pandey8-Aug-07 19:55 
GeneralRe: Switching between two threads Pin
Leslie Sanford8-Aug-07 21:41
Leslie Sanford8-Aug-07 21:41 
GeneralRe: Switching between two threads Pin
praveen pandey8-Aug-07 23:51
praveen pandey8-Aug-07 23:51 
QuestionBypass character in textbox Pin
Edwin Syarief8-Aug-07 17:46
Edwin Syarief8-Aug-07 17:46 
AnswerRe: Bypass character in textbox Pin
-BoBo8-Aug-07 17:52
-BoBo8-Aug-07 17:52 
GeneralRe: Bypass character in textbox [modified] Pin
Edwin Syarief8-Aug-07 17:54
Edwin Syarief8-Aug-07 17:54 
GeneralRe: Bypass character in textbox Pin
Christian Graus8-Aug-07 18:35
protectorChristian Graus8-Aug-07 18:35 
AnswerRe: Bypass character in textbox Pin
Nouman Bhatti8-Aug-07 19:43
Nouman Bhatti8-Aug-07 19:43 
AnswerRe: Bypass character in textbox Pin
Edwin Syarief8-Aug-07 21:27
Edwin Syarief8-Aug-07 21:27 
QuestionUpdating DataSet Pin
-BoBo8-Aug-07 17:29
-BoBo8-Aug-07 17:29 
AnswerRe: Updating DataSet Pin
hamid_m8-Aug-07 19:23
hamid_m8-Aug-07 19:23 
Questiondouble buffering for flickering problem Pin
cyn88-Aug-07 17:10
cyn88-Aug-07 17:10 
AnswerRe: double buffering for flickering problem Pin
Martin#8-Aug-07 20:26
Martin#8-Aug-07 20:26 
AnswerRe: double buffering for flickering problem Pin
Luc Pattyn9-Aug-07 1:04
sitebuilderLuc Pattyn9-Aug-07 1:04 
QuestionFormula - How many address in a range Pin
StevenWalsh8-Aug-07 17:01
StevenWalsh8-Aug-07 17:01 
AnswerRe: Formula - How many address in a range Pin
Christian Graus8-Aug-07 17:29
protectorChristian Graus8-Aug-07 17:29 
One presumes you need to take an IP address, split it into four numbers, and check if each of those numbers is within the ranges specified by doing the same to your range IP addresses.

string [] lower = "10.126.0.1".Split(new char [] {'.'} );
string [] upper= "10.127.0.1".Split(new char [] {'.'} );

string [] range = newIp.Split(new char[] {'.'} );

// check here that range contains 4 strings

bool match = true;

for(int i=0;i<4;++i)
{
match &= (int.TryParse(lower[i]) >= int.TryParse(range[i]));
match &= (int.TryParse(upper[i]) <= int.TryParse(range[i]));
}

Something like that would work, but it has levels of nastiness.

1 - it assumes the values coming in are all valid numbers. Using TryParse would add a lot of code, you could add a try/catch ( if it blows up, they can't match ).

2 - it parses range[i] twice, instead of storing it.

But, it should work, and should give you a good starting point. Assuming my assumptions about the rules that define a number being 'in the range' are correct.


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 )

GeneralRe: Formula - How many address in a range Pin
StevenWalsh8-Aug-07 18:05
StevenWalsh8-Aug-07 18:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.