|
mav.northwind wrote: If you have a fixed number of columns and a variable number of rows, I think it's rather an array of lists than the other way 'round, but I guess it depends on the view...
You can do it either way, but I know which one I would use...
A list of arrays:
List<string[]> table = new List<string[]>;
table.Add(new string[] { "just", "adding", "another", "little", "line" } );
string[] line = table[0];
An array of lists:
List<string>[] table = new List<string>[4];
table[0] = new List<string>();
table[1] = new List<string>();
table[2] = new List<string>();
table[3] = new List<string>();
table[4] = new List<string>();
table[0].Add("just");
table[1].Add("adding");
table[2].Add("another");
table[3].Add("little");
table[4].Add("line");
string[] line = new string[] { table[0][0], table[1][0], table[2][0], table[3][0], table[4][0] };
---
single minded; short sighted; long gone;
|
|
|
|
|
arraylist is a class by taking it's object u can add items as many as u want
|
|
|
|
|
You can add as many data as you want to a List or Collection in .NET until you use all the memory and blow your application which is not a preferred but available option
And if you remember that you are using integer or long vale based indexes on arrays to retrieve an item at a specified index, these data types have minimum and maximum properties. Of yourse, you can write your own data type and use it in List<t> or Colelction<t> and successfully blow your application again 
|
|
|
|
|
Okay, I am trying to implement a way to pass parameters to an already running thread or application. I have added some "Run Once" logic to an application of mine and it works great, if you try to load it twice...it looks for the thread by name, and if it finds it it just activates it. It works great...BUT...I want to pass 2 params to the running thread and this is how I am doing it and it is not working...not totally. So once my app is running, I will call the exe again and pass 2 params to it, when the second instance tries to start, I receive the params and save them to my properties.settings.default.variable1, variable2. then save the settings, check my thread, and if its running I just activate the running thread and exit. When the activated event fires I then look at the value of my properties.settings.default.whatever and the data has not changed, BUT if I exit the app at that point and start it again...the values have changed. Its like the running thread has a different session of the data open and it dosen't see the changes. So my question is: Is there a way to refresh the data session of the properties.settings stuff so I can see the last changes made??? or is there another way to pass the params to my running thread from the started thread????
Thanks...
Christopher J. Thornburg
Senior Systems Analyst
Ideal Card
|
|
|
|
|
If I am understanding your problem correctly, what is needed is to have a data location where the modifications are made and the thread can access the data. This should eliminate the need for parameters. Keep in mind that when multiple threads are accessing a data location, it should be protected in such a way that only one thread can access/modify the data at a time.
Phil
|
|
|
|
|
Such as writing the params to a text file and then reading them in duing the activate event of the form???
Christopher J. Thornburg
Senior Systems Analyst
Ideal Card
|
|
|
|
|
That is one method used when dealing with multiple applications. There are other methods as well. For instance using a registry key, a memory mapped file, interprocess communication, and so on.
Phil
|
|
|
|
|
You can make a static class that exposes properties that you can set/get from different threads. So when your activated event fires the thread will get the value of the property. Because you are using a multi-threading application the static properties should use lock {...} inside the get/set.
http://stefanprodan.wordpress.com
|
|
|
|
|
Use:
Thread.Start(object) method as:
public void Start (
Object parameter
)
where you pass a static or a dynamic but(reference is kept to prevent garbage collection "WeakReference can also be considered for this case") object which includes your parameters that you can change while the thread is running.
ALSO, searching a Thread by it's name is not preferred, try keeping a reference to each thread you create, better an integer value or byte(if you don't have more than 255 threads in your application ) and access these threads with these indexes. You can also use a Dictionary<string threadname,="" thread="" threadinstance="">, anyway.
As a result you can modify your parameters in the objectargument you pass and also keep a reference of in you main thread. BUT, be careful chosing and a using a type for your object argument. If you are using value types, modify the real data accessing it through "ref" keyword.
|
|
|
|
|
Here is the deal I am writing an application that reads certain information from a MSI database to populate a XML File. I have got most of the info I need but running into a wall with getting the shortcut path. I have been searching MSDN and found this.
(MsiGetTargetPath) http://msdn2.microsoft.com/en-us/library/aa370303.aspx
There are 3 peices of info I need from the shortcut table.
1. The Name of the shortcut (I already know how to query this)
2. The Working direcotry (Since the database uses VARIABLES for everything I need a good way to determine what the acutal path is from the VARIABLE name)
3. The path where the shortcut is being created (Same problem as stated in # 2
If I can find a way to get this to work then I feel I am home free. Any thoughts or suggestions.
PS I need to do this without installing the MSI.
Thanks,
Cyber 
|
|
|
|
|
Hi,
Im using C#.Net 2003,framework version 1.1,In the folder we can add the user manually by right click the folder-->properties-->security-->add-->user.Here i want to add user to the folder by programmatically,how do i achieve this.Help me..
Rgrds
Kanna..
|
|
|
|
|
|
Hi
I am working with windows application where i have webbrowser control which will display the report(html) page on webbroser control. I have two panels one will show the test execution and other will show the test results. So once the test execution is finished i am loading the report (html) page into the second panel's webbrowser control and showing that panel. In between the tranisition from one panel to other panel i am trying to display one messagbox showing that whether test execution passed or failed. But some times Messagebox doesn't respond to click event (its hanging). when i analyzed the issue during that hanging time WebBrowser.DocumentCompleted Event is happening. When i googled thru the interenet i came to know that WebBrowser having some knowns issues. can anybody tell me whether WebBrowser.DocumentCompleted Event will hide all the windows events (i.e. click).. is it the reason why message box click didn't respond? Also please tellme is there any other know issues on WebBrowser control!
Thanks
Srini
|
|
|
|
|
|
Hello,
In all regular mobile phone set, I see that, JAVA applications can be installed and run. But I dont know Java and I want to use C# to make a phone application. Is it possible or not. Can u send me any reference URL ?
Regards
Bashiwala.
|
|
|
|
|
bashiwala wrote: But I dont know Java and I want to use C# to make a phone application.
Only if you can cram the .NET Framework into the phone. You can only use C# if your phone supports the .NET Compact Framework. If not, you can't use C#.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi
I'm struggling with a strange problem here, I can't set the text of a button in some circumstances.
Here's my code:
private void btnGo_Click(object sender, EventArgs e)
{
try
{
btnGo.Text = "Processing...";
}
catch (...)
finally
{
btnGo.Text = "Start";
}
}
If I remove btnGo.Text = "Start", then the text "Processing" shows up once the long operation has finished.
/edit: I solved it by calling btnGo.Refresh() after btnGo.Text. But why is this necessary, will the button repaint itself only after another Paint-Event occured?
Does anyone know what might be causing this strange behaviour?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You need to use Asynchronous process using threads
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Immediately after settings the button text, just call Application.DoEvents() , so your application gets and processes the message to repaint itself.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
There are many ways to do it if any one want to make user wait untill the process completes he can use asyncronous process as back ground thread .
There are n number of articles available on CP .
i know it is very tidious but more effective than Application.DoEvents()
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
There are also some people who are not ready to start throwing threads around. There are also situations where threading a process isn't acceptable, or would be too much work to keep the user from waiting for 1 or 2 seconds on a simpler process.
He really didn't give any kind of information about what this process was doing. So, to keep his code simple, DoEvents is a very easy fix to the immediate problem. If he wanted to move this process to a background thread, he can ask about that all he wants and we'll help with it.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I'm absolutely familiar with Threads and right after I posted this question I found the solution myself
I may switch my app to use threads in the future, but it's just a simple app for myself which querys a small database and displays some data, so button.Refresh() will do the job here.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greeeg wrote: I'm absolutely familiar with Threads and right after I posted this question I found the solution myself
Great!
Greeeg wrote: it's just a simple app for myself which querys a small database and displays some data,
Hence, the "simple" suggestion.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
May be the process is too fast, so the processing happens in less than second, and the finally line anyway will make it = "Start".
|
|
|
|
|
This is not a strange behavior, your should start a new thread to do the time consuming work and on the finish event of the tread set the btnGo.Text = "Start".
http://stefanprodan.wordpress.com
|
|
|
|