|
Sorry, can't give an example, i never had to use it as fart as i remember.
A workaround[^] is, as the name states it, that you work around a bug or other weird thing instead of solving the bug/weird thing. Sometimes you can't solve that problem because it's not your fault, and you dont have access to the problems code and so on. Then you have to work around it.
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
I have a C#.Net program that once a button is clicked it goes to a public class(called Tal) and gets data in a vector, then exits the class, and goes back to the main form(program). I will do this task over and over. I want to take the data ,do many(over 20) calculations, and go back to the program. How can I get access to the data array(vector) from the main program? I keep getting different errors and have tried so many different ways. Thanks in advance.
Code:
{
Mainfrm
tal.talbars();
}
Public Class tal
// get vector array
Price[] closes = row["SETTLE"] == null ? null : row SETTLE"].PriceVectorValue;
int first_element = elements - 5; // to get 5 back
for (int i = first_element; i < elements; i++)
static void talbars
tal();
So I want to use closes[1-5] in the main program. I get not in namespace error(I put the whole class in the main form, so that shouldnt be an issue). I get name doesnt exist in class also. Any ideas would be greatly appreciated.
|
|
|
|
|
I will make it more basic.
Namespace Program
{
Main()
{
class.tal; // goto class to get data
double calc;
calc = data[1]+data[2];
Console.Writeline(calc);
} //end of Main
Public Class Class()
public void tal
{
// get data for data[1] and data[2]
} // end of class.tal
} // end namespace
I will have alot of data[] and a lot of calcs to be done in the main(cant be done in class). So I get errors when I try and use data[] in Main. Im new to C# and I know its something simple, I just cant figure it out. Thanks again.
|
|
|
|
|
how can i change textbox width at runtime. I want to drag the textbox like v do while designing.
AjayO@PMAM.com
|
|
|
|
|
ajayo wrote: how can i change textbox width at runtime
I would guess you could use the Size property.
|
|
|
|
|
thanks but as i mentioned I want to be able to drag right side of the textbox and change size like v do it in designer.
|
|
|
|
|
Hi Ajay,
did u got the solution for ur problem?
we can write the code to change the textbox width at runtime, but i don't know how to write the code to allow the user to drag the textbox. please whenever u find the solution, try to post the code here.
thanks,
Rahi
|
|
|
|
|
Hi, I know that it's possible to set the ProcessorAffinity in Diagnostics.Process to use only one processor, but how can I do this for a forms application?
|
|
|
|
|
Get a process object for your form and use the ProcessorAffinity member.
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Thanks for the suggestion, it sounds logical and I was figuring the same. I haven't found a way to retrieve a process object from a form, however. There's no property or method that lets me fetch it. Would anyone happen to know how this is done?
|
|
|
|
|
There's a static method Process.GetCurrentProcess() you can use.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Found it, thanks a bunch!
|
|
|
|
|
I have a requirement in one of our project, we will upload high resolution files to server, but when rendering/downloading the file, user may not require that much high resolution file which takes much time in downloading. For this we have download options,where user can select download size, resolution, after applying this size and resolution to the actual file we have to download the file. can any one please tell me in .Net required code to apply this size and resolution to an image?
|
|
|
|
|
I am running the application using app domain and get the updated version of the current running application using app updater.dll.
The application updated successfully but it not show properly, it closed immediately after updated?
Why the application close immediately.? I want display the updated application.
Please give solution for this problem.
Thanks
|
|
|
|
|
Hi I am trying to get a list of all dates that are between 2 dates so if the dates are
01/08/06 to 06/08/06
the result that I would hope to get is something like this
02/08/06
03/08/06
04/08/06
05/08/06
But my main problem is that I need to count amount of days a player has missed through injury but if the player has 2 injuries at the same time then certain overlapping days are counted twice like these dates here
08/01/2006 to 08/15/2006 14 days
08/01/2006 to 08/25/2006 24 days
I am trying to fill a table with all days and then remove duplicates but I would appreciate any help thanks in advance
Tim
|
|
|
|
|
This sounds suspiciously like a homework question to me.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
have not done homework in a few years now but ill freely admit its work for college and is a bit of a struggle
|
|
|
|
|
Why dont you show us what you've already tried, and specifically what problems you are experiencing, and im sure someone will help you out with your homecollege work.
|
|
|
|
|
well my main problem is i dont know if its possible and whether i shud use sql or c#
i can get a count of days between the datesin sql but thats not much good to me really as it doesnt take care of the duplicate days problem
|
|
|
|
|
There are so many ways to do this. Without knowing the full problem, you could use something like this (pseudo):
Add Injury (passing in start date and end date)<br />
if start date = end date then<br />
Check to see if the start date has already been added into your collection.<br />
If not, add it in and exit routine<br />
<br />
set date = start date<br />
while date is less than or equal to end date<br />
Check to see if the date has already been added into your collection.<br />
If not, add it in.<br />
date = date + 1 (hint - you need to use AddDays for this).<br />
end while
By doing this, you can easily track the dates that the player has been injured.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
would it be ok to use a DataTable as the collection of dates and if so then is it as simple as compare each date to each cell in datatable to see if it is already in there
|
|
|
|
|
It would probably easier to use something like a Hashtable
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
i have never worked with hashtables before do they have some advantage over a datatables
|
|
|
|
|
Well, they do have a key that you can look up.
For instance:
private Hashtable _myTable = new Hashtable();<br />
<br />
public void AddItem(string value)<br />
{<br />
if (_myTable.Count > 0 && !_myTable.ContainsKey(value))<br />
_myTable.Add(value, value);<br />
}
Then, in your code you could do:
AddItem("Hello");<br />
AddItem("Hello 2");<br />
AddItem("Hello");
The list will only contain Hello and Hello 2. The last item will not be added.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
thanks alot for the help its appreciated i ended up using an arrayList to store the dates for each injury but ill def have a look at the hashtables
thanks again
private ArrayList AddDaysInjuredToArray(DateTime startDate, DateTime endDate, ArrayList dateList)
{
//*** set arraylist = to arraylist of days returned
dateList = AddDatesInBetween(startDate, endDate, dateList);
//*** sort arraylist making it easier to find duplicates
dateList.Sort();
//*** remove duplicates
for (int i = dateList.Count - 2; i >= 0; i--)
{
if ((DateTime)dateList[i] == (DateTime)dateList[i+1])
dateList.RemoveAt(i+1);
}
//*** return arrayList containing list of days injured with no duplicates
return dateList;
}
private ArrayList AddDatesInBetween(DateTime startDate, DateTime endDate, ArrayList dateList)
{
//*** start with day after startDate as startDate is not to be counted
DateTime newDate = startDate.AddDays(1);
//*** while newDate before endDate
while (newDate < endDate)
{
//*** add newDate to arraylist
dateList.Add(newDate);
//*** set newDate to next date
newDate = newDate.AddDays(1);
}
//*** return arrayList containing list of days injured
return dateList;
}
|
|
|
|