|
Hi
Just a simple approach, but not feasible,
see bellow code
private void listView1_ColumnWidthChanged(object sender, ColumnWidthChangedEventArgs e)
{
if(listView1.Columns[e.ColumnIndex].Width != 50)
listView1.Columns[e.ColumnIndex].Width = 50;
}
check the static column width, if it miss matches then it is changed so reset it , this is a simple approach, if you find some other good method follow that.
thanks
|
|
|
|
|
Actually this would a little be better:
private void listView1_ColumnWidthChanged(object sender, ColumnWidthChangedEventArgs e)
{
e.Cancel = true;
e.NewWidth = listView1.Columns[e.ColumnIndex].Width;
}
|
|
|
|
|
Hi all
Can some one lead me for a good logic to generate the regular expression dynamically.
Example:
I give an input like bellow
1. Us phone no - (910)456-8970 => regular expression is: @"\(\d{3}\)\s\d{3}-\d{4}"
2. Email Id - miltoncse00@yahoo.com => string pattern=@"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" +
@"0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z]" +
@"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
My Need,
By getting (910)456-8970 this string i want to construct the regular expression like @"\(\d{3}\)\s\d{3}-\d{4}"
and i have to do for all the string vice versa. Can some tell me some techniques or logic to incorporate.
My Real Problem With Regular Expression :
I have to mask the fields in website based on the pattern like usphone,emailid etc...
thanks in Adavance
|
|
|
|
|
I doubt that you can (correctly) deduce a regex from sample data. Take the phone-number column as an example, with this data;
555-423325 What mask would the first three five's generate, and would that mask be reusable as a phone-number-mask?
It gets worse, since the generated mask isn't a phone-number-mask (even if you base it on the data in that column) - it will be a mask that allows all data within that column (since that's what it's based on).
The best approach would be to make a list of examples for each column, containing correct and incorrect values. Next, you base the regex on the domain of the values that you expect. Lastly, a unit-test to verify that the regex works
I are Troll
|
|
|
|
|
Hi thanks for your reply,
The mask is not only for a corporate sites, it is for the entire web.
if i specify to mask all the security No (SSN) in a page, even if i Google it also, i have to mask the SSN in the Google page as (XXXXXXXX). I have done that using ihtmlElementCollection (BHO). My problem is i know SSN format so there is no issue.But there can be any format, so just seeing one format dynamically i want to generate the regex. This question may be quiet meaningless, but we can could arrive a solution. if no one had come across like this, then i will try to generate a algorithm to achieve, but my thinking is, if already some one knows on that, then i don't want to wast my time to creating algorithm again.
thanks any suggestions are greatfull
Thanks
|
|
|
|
|
jasome wrote: But there can be any format, so just seeing one format dynamically i want to generate the regex.
Your application encounters the string "8572398947". Is that my SSN (being Dutch), or my SSN + 1, or just a random number? How would you know that the string is in fact, a SSN if you cannot verify that it is?
I are Troll
|
|
|
|
|
Hi,
Good exactly you are correct,
sorry for taking the SSN no instead take USPHone No like ... etc..
added to that for SSN there is option to mask based on the Field value, for
example if the input/span element contain SSN then i mask that.
This regex is only for unique analyzing
for example if i give :
user@gmail.com - we can make regular expression for all the mails,
Thanks for your continuous encouragement
you are most welcome to make a comment on that....
|
|
|
|
|
jasome wrote: for example if i give :
user@gmail.com - we can make regular expression for all the mails,
So taking this example, you take that input and generate an "email address" regex from it. Now I try to enter my email address (which is .co.uk) and whoops, it fails. Yet mine is a totally valid email address.
There is absolutely no way you can make a regular expression from input data and have it work in all cases.
|
|
|
|
|
jasome wrote: user@gmail.com - we can make regular expression for all the mails,
That's assuming that the computer can recognize this as a valid email-address. The fastest validation would be done over a regex. (That's recursion, right there)
In other words; you don't know if the data is valid - thus any regex that's derived from it would be a good fit for the sample data, but not for the mask that you want.
I are Troll
|
|
|
|
|
hi to all.....
plz help me in....how to design page navigation window form using back and next button......for exmple...if we take a window like install wizard window..in that v use a button name as next.. if we clik that next ..the next page ill be open ...like ....sooo can u any one send me that source code...
@nu Gunturi
|
|
|
|
|
Don't ask for source code. Present your problem and how you've tried to solve it and include any error messages / exceptions etc.
To answer your question: if you want to create something like a WinForm wizard, open the "next step" form when clicking the "Next" button and close the old form (or hide it if the user wants to go back). Pass on any paramteters you might be needing.
|
|
|
|
|
Hi if it is in web application.
You have properties in the Datagridview itself.Just google it, you will find the answers,
But my concern on paging is based on the performance, i am not interested on bringing 100000 records to the client side just to show 10 records in the gridview. so i am manipulating and doing paging in the database itself( SQL SERVER 2005),i have checked this performance. it is 7 times faster than the ordinary paging comes along the gridview.
Try it.I have done a user control for paging and filtering works fine.
thanks.
|
|
|
|
|
hai im asking in windows application........
|
|
|
|
|
Hi even if it is in windows application and
if you use client server application, and if you bother about the
performance you can follow what i suggested above.
thanks
|
|
|
|
|
search it in codeproject -> "wizard".
There are lots of articles about that.
|
|
|
|
|
Hi guys/girls,
When you use MessageBox.Show("message here"), the programme will effectively freeze and wait for you to press OK on the message box before continuing in the code.
How do I make this happen for my own custom built pop-up windows?
I'm sure this should be simple but i'm stumped
Any help would be great!
Thanks in advance
Lee
|
|
|
|
|
How are you showing them? Using Show method? Use ShowDialog instead.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
SOLVED!
Thanks so much! When you're new, the smallest things can be so retardedly difficult to find solutions for...
|
|
|
|
|
|
Hi,
Take a look at the MessageBox.Show() overloads.
There is one overload you parameterize with a IWin32Window handle (your Popup window) this should help you out showing your messagebox modal.
greetz
|
|
|
|
|
Does anyone know good software that reades my source code and creats a Nassi-Shneiderman diagram automatically?
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
digimanus wrote: Nassi-Shneiderman
That still exists?
|
|
|
|
|
Hi all
sorry for reposting.Im using socket programming to send data from one system to another.im running client and server on both systems.my problem is when i send a message from client of one system it reaches the server of other system, how to send that recieved data to localhost client. below is the code:-
client:-
private void sendButton_Click(object sender, EventArgs e)
{
TcpClient socketForServer;
try
{
socketForServer = new TcpClient(_ip of sending machine , 10);
}
catch
{
MessageBox.Show("Failed to connect to server at {0}:999", _machineName);
return;
}
NetworkStream networkStream = socketForServer.GetStream();
System.IO.StreamWriter streamWriter =
new System.IO.StreamWriter(networkStream);
System.IO.StreamReader streamReader =
new System.IO.StreamReader(networkStream);
try
{
streamWriter.WriteLine(this.messageTextBox.Text);
streamWriter.Flush();
this.messageTextBox.Clear();
this.messageTextBox.ReadOnly = true;
this.messageTextBox.Text = streamReader.ReadLine();
}
catch
{
MessageBox.Show("Exception reading from Server");
}
networkStream.Close();
}
Server:-
TcpListener tcpListener = new TcpListener(10);
tcpListener.Start();
while (true)
{
Socket socketForClient = tcpListener.AcceptSocket();
NetworkStream networkStream = new NetworkStream(socketForClient);
System.IO.StreamReader streamReader =
new System.IO.StreamReader(networkStream);
string theString = streamReader.ReadLine();
MessageBox.Show(theString);
streamReader.Close();
networkStream.Close();
socketForClient.Close();
}
IF Clinet-B connects to server and sends message, before disconnecting how can Client-A connect to servere.
|
|
|
|
|
Ajithevn wrote: how to send that recieved data to localhost client.
The client will connect to the server at the IP address specified in the socket. Check which IP address you are using in your connection. See also this sample[^] on MSDN.
|
|
|
|
|
If there are 2 machine Client-A(168.132.2.3) and Client-B(168.132.2.5) with these ip.
Client-A connects to server with IP address specified in the socket as "Client-B(168.132.2.5)" and recieve a message from Client-A as soon as the message is recieved i need to send that message to Client-B. how is that possible?
|
|
|
|