|
Sure, either poll the columns widths after a filtered DGV updated (not my first choice) or see what the filtered DGV's ColumnWidthChanged event is going to do for you.
|
|
|
|
|
So no magic wand hidden somewhere deep inside DGV land; OK, thanks.
|
|
|
|
|
That seems to be the recurring theme in the questions today: "How can I automatically do this?"
Nope, no magic wand, unless you write it yourself.
|
|
|
|
|
So How Can I Add DGV's Predefined Properties And Members To Custom Control
Can You Give A Sample Code Please.
|
|
|
|
|
You'll have to create your own Properties, using the DGV's properties as their backing fields.
|
|
|
|
|
Hi,
The c# code is populating a workbook template with the latest data which is run by
the c# code...
in the c# code there is workbook.RefreshAll();
At this stage, I expect to see the latest data inside the spreadsheet BUT the template shows the old data which was in the template before.
To see the latest data, I have to go to the spreadsheet which was populated but I have to click on data, refresh data to see the latest figures.
How can I solve this please?
Thanks
|
|
|
|
|
A useful tip for solving a problem such as this is to look at the code generated by the MS Office macro recorder.
In your case go the spreadsheet, turn on the recorder, and perform the actions required to refresh the data.
Examine the macro's BASIC source code to find out how it was done. It usually fairly simple to write the C# version but if you have any problems post the macro code here.
Alan.
|
|
|
|
|
Hi,
Macro is not being used.
It is c# as mentioned before.
Thanks
|
|
|
|
|
Alan's right... Even if you're not using macros for your actual project, try recording a macro that does what you need. Excel will automatically generate the code in VBA, and you can use that as a guide to figure out how to do it in C#.
|
|
|
|
|
Yes I understand that you are not writing a macro but in many cases macro code and office interop code are very similar. This means that the macro code for the update operation will show you which methods and properties you should use in your C# code.
Alan.
|
|
|
|
|
hi guys,i would like to know how to create a captcha application using c# which must show the user a picture of a shape eg,circle etc,and this shape must be generated randomly each time the web page is loaded.
the application will require the user to identify the picture by typing in the name of the shape, than click the submit button.
|
|
|
|
|
This wouldn't be a good captcha ... it would only have a small number of possible results so it would be easy to spam past.
|
|
|
|
|
Some good samples here[^], note the second one is a CodeProject article.
|
|
|
|
|
Why not just use reCAPTCHA[^] - it's free, it's easy to use and people are familiar with it. Plus, it helps digitize books...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I second the reCaptcha recommend!
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
1. Have the image files named Captcha00.png ... Captcha09.png
2. Generate a random number from 0 to 9
3. Append that number to the string "Captcha0" then append ".png" to it.
4. output the resulting string to the webpage
5. compare the input text to what was computed in step 2
But as someone else said, this may not be a very secure Captcha.
A better one is to generate a simple equation with an "infinite" number of permutations. Such as a + b * c = where a, b & c are random integers between 2 and 99.
The best one is to implement with open source reCaptcha.
Good luck.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
Hi,
In windows application how can i validate the ip address in a textbox on key press event.
I have used masked text box but still no solution.
Can anyone give me a solution ?
Thanks in advance.
|
|
|
|
|
|
Your regex is broken (but then so is mine - I'm about to fix it and explain why). You don't want \b before and after. Also, yours would accept 345.567.678.789, which is not a valid IP address!
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I agree with you, my regex would accept 999.999.999.999 as well. I will update that.
Thanks....
I quit being afraid when my first venture failed and the sky didn't fall down.
|
|
|
|
|
Use a regular expression, such as
^(2[0-4]\d|25[0-5]|[01]?\d\d?)\.(2[0-4]\d|25[0-5]|[01]?\d\d?)\.(2[0-4]\d|25[0-5]|[01]?\d\d?)\.(2[0-4]\d|25[0-5]|[01]?\d\d?)$ (wrap it in whatever delimiters you need.)
If you can't read this, get a copy of Expresso and paste the expression into the expression window.
[edit]I thought it was broken, but it's not... It's just smarter than I am feeling right now. Need coffee! Forget the edit.[/edit]
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Regex is NOT necessary.
Just use IPAddress.Parse(myIPAddress) , and handle the FormatException exception.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
And there we have the correct answer. Regexes are good - when used in appropriate cases. Reinventing the wheel is not the case though.
|
|
|
|
|
Oh John....you wouldn't be using exception handling as program flow control now would you? Naughty boy - go sit in the corner... Perhaps using IPAddress.TryParse() would be less "expensive"?
C# has already designed away most of the tedium of C++.
|
|
|
|
|
The cost in a GUI (per the OP) would be difficult to measure and certainly not significant.
Actually I am not sure what sort of application it would take where this would be expensive. It would require all of the following.
1. IPs arrive as strings.
2. A signficant number are invalid.
3. There are a lot of them.
|
|
|
|