|
Hi all,
I want to save the sender (object) or the information comming from th controls into an array. How to do that ?
object arr = new object[100];
void xyz_method (object sender, System.EventArgs e)
{
arr[i] = sender; // that didn't work
}
Thank's
regards
Frank
|
|
|
|
|
You have declared arr to be an object rather than an array of objects. That will make arr reference to the array rather than being the array. To use the array you would have to cast arr as being a reference to an array of objects:
((object[])arr)[i] = sender;
Instead, declare arr as an array:
object[] arr = new object[100];
Have you assigned a value to the variable i?
---
b { font-weight: normal; }
|
|
|
|
|
Why didn't that work? That aside, I'd suggest using an ArrayList, as hardcoding the array size as 100 is not a good idea.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi!
Do you know a Documentation or a good book? I want to write an eventhandler which catchs events, if a user writes a new date in the calendar or deletes some dates.
I need an example or something else!
Thanks!
|
|
|
|
|
Hi
I'm trying to execute some code after a dialog is initially displayed (but before the user has control), but I can't find an event that is triggered when this happens. What I'm trying to do is simulate a button click when certain initial conditions exist, but all the events I have tried (such as Activate) don't update the display until after the code has finished executing, and as this takes a relatively long time I need it to show and update my progress bar.
Can anyone help?
TIA
Ian.
|
|
|
|
|
Hi!
The event you're looking for is probably the Load event.
But no matter which event you choose, your GUI will usually not update inside a long-running action unless you call Application.DoEvents() to allow Paint events (and all others) to get a chance to execute.
Regards,
mav
|
|
|
|
|
Hi mav
Thanks for the response - I've tried using the Load event, and I was already using Application.DoEvents() in a couple of places, but even if I put them in the loops I still didn't see any part of the dialog until it had finished processing. However, I've now put in a call to Show() before the processing starts, and this seems to have done the trick!
Regards
Ian.
|
|
|
|
|
Hi, I have a little function for stripping the last part of an url using regular expressions. I did construct the expression in Expresso and have tried it on regexlib.com (http://www.regexlib.com/RETester.aspx). Works beautifully exept in my C# code! Can anyone see what I'm doing wrong.
<br />
private String stripFromUrl( string url )<br />
{<br />
String stripUrlPattern = "(?<fixedUrl>.+(?<=/))";<br />
Regex r = new Regex(stripUrlPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);<br />
string stripurl = r.Replace(url, "${fixedUrl}");<br />
return stripurl;<br />
}<br />
The problem is that the string does not change at all. It just returns the string unchanged!
Please help!
|
|
|
|
|
|
From what I can tell from the documentation, named matches is not supported.
Try using the pattern "(.+(?<=/))" and use the index of the match in the replace: "$1".
---
b { font-weight: normal; }
|
|
|
|
|
I found out what I was doing wrong. I need to match the whole string (not only the part I wanted to extract). So I added a named variable called <rest> to match the rest.
This my current version:
<br />
private String stripFromUrl( string url )<br />
{<br />
String stripUrlPattern = "(?<fixedUrl>http:// [ \\w \\. / ]+) (?(/) (?<rest>.+) | (?<rest>(?<=/).+) )";<br />
Regex r = new Regex(stripUrlPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);<br />
string stripurl = r.Replace (url, "${fixedUrl}");<br />
return stripurl;<br />
}<br />
|
|
|
|
|
|
I use System.Uri to get the returned url but it returns the filename and parameters also. I'm Changing relative paths to absolute. That's why I need Regex to strip the filename off the Uri.
|
|
|
|
|
Hi,
Here i am facing one problem in making .exe file,whole situation is like below.
My main project is in C#.net and i had made .dll file from that,now client requirement is that,he wants to run the .exe file of our project from vb 6.0 but that must be console application so i had made .dll file from my project and one another .net project include that .dll and then i made .Exe file of that project which is .net console application,it means that my second project is includes .dll of my project and now for testing purpose i had made third project which include second projects only .exe file but now problem is that third project also required first projects .dll otherwise it is not working.
Here is 3 project's outputs and included files.
first project : out of that made .dll file.
second project : made console application and include first project's .dll file and then made .exe file
Third project (for testing) :if i include only second project's .exe then project is not working and if i include second project's .exe and .dll both
if working fine.
Now my question is that why my third project required .dll of second project,actually third project should not required .dll file ,only .exe of second project is enough.
hope you not confused with all of above.
if any query regarding understanding pls ask me.
|
|
|
|
|
Perhaps a little more punctuation would help?
From what I understood, you have 2 executables and a dll. One of the executables is linked to that dll, the other only uses the first executable. If you are asking why the dll is needed, you haven't understood dynamic linking.
DLL (dynamic linked library) means that linking (resolving method names to addressed) takes place when the executable is loaded into memory. Which obviously means that the dll has to be available when the executable is loaded.
Does this make sense?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi,
I want to cut a mpeg file into parts. I am using MCI from winmm.dll.
I can do play stop, pause , fast forward or slow motion but unable to edit (cut ,copy or paste). could somebody help me? A sample code will help a lot. Thanks in advance.
Ashish
|
|
|
|
|
Well, last time i didn't find the answer for my question - how to create new database file (*.mdb) programmatically, and i try it once again.
And i want to know, if it's possible to enumerate tables in the database? I know it was possible in mysql...
Where can i find all the SQL Statements possible for Access (SQL specification for Access)???
Two last question i posted in the forum... Thank YOU very much for participating... I really appreciate your attention...
|
|
|
|
|
You will need a COM library for that. I think it's called ADOX.
Here's an URL for a VB6 example. Shouldn't be hard to translate it to C#
http://www.freevbcode.com/ShowCode.Asp?ID=803[^]
WM.
What about weapons of mass-construction?
|
|
|
|
|
I plan to create a custom textbox class that when user press the enter key it will focus to another control. But i would like to check out that, should i place the GetNextControl method in the textbox class or in the base form class ? I found that code below not working ..
<br />
public class baseTextBox:System.Windows.Forms.TextBox <br />
{<br />
protected override void OnKeyDown(KeyEventArgs e)<br />
{<br />
if (e.KeyCode == Keys.Enter) <br />
{<br />
Control ctrl = this.GetNextControl(this,true);<br />
ctrl.Focus();<br />
e.Handled = true;<br />
}<br />
}<br />
}<br />
Please advice. Thanks.
|
|
|
|
|
|
Thanks for help.
So i should put the code in a base form class instead of inside the textbox base class right ? Instead of using "this" so what should i use ?
|
|
|
|
|
hi dears,I have created asp.net proeject.i am facing a problem.
I have applied paging on datagrid.I have set page size to 10 record per page.I want to show "ext"on the Left of my Grid and "rev"on the Right of my Grid.Is it possible to do in grid.Give ur comment at my Email address
rahimali_imt@hotmail.com
Thank in Advance
|
|
|
|
|
|
no text
---
b { font-weight: normal; }
|
|
|
|
|
if anyone knows anything about c++ and mysql please try to help me, and go
to:
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=1153332
.
there you can find a big problem i have.
please help me sigh: sigh: sigh:
|
|
|
|