|
Mark Salsbery wrote: divide the displayed percentages by 4 (the number of processors on my
system)
Show off
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Well...two physical
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I have an application that creates a certain number of textbox controls (based on a number specified by a user) at runtime. I have the textboxes being created in the page_load method. I have created a another TextBox object to find the created controls and retrieve the text. I then pass the text to a string object. My issue is that when I try to retrieve the values inputted into the textboxes by a user, I receive an 'Object reference not set to instance'. I have provided code below. Any assistance will be great. Thanks in advance.
for (int i = 0; i < numberOf; i++)
{
TextBox tb = ((TextBox)Page.FindControl("txtName" + (i+1).ToString())) as TextBox;
results += tb.Text //this is where error occurs.
Response.Write(results);
}
|
|
|
|
|
Hi,
I start a windows service.
The process inside the service has several steps and they all take very long to complete so as a result the service times out and gives the following message :
"could not start the service on local computer.
Error 1053: The service did not respond to the start or control request in a timely fashion."
And therefore the task does not get completed.
Any thoughts please?
Thanks
|
|
|
|
|
The OnStart method shouldn't be performing task, it should kick off a thread (or similar) that does the work and then return.
|
|
|
|
|
Placed a timer inside the onstart event.
The timer starts the process which calls a web service.
The web service takes a very long time to complete. But before it completes the windows services times out even though it has started.
Any thoughts please?
Please note that when I run the web service manually, i.e. browsing to the .asmx and click invoke, the process takes a long time but eventually it will complete.
Thanks
|
|
|
|
|
I use a System.Timers.Timer for my Windows Services too.
The Timer should be a field of the class, the OnStart method should Enable or Start the Timer and complete.
|
|
|
|
|
Hi Guys
Can anybody help me to read the csv file using c# and store in the sql database.
Subash
|
|
|
|
|
If you look down this page you'll see you're the 3rd person to ask a similar question in the last few hours. Perhaps you can get some ideas from what they've posted and the relevant replies.
Could it be that you're all doing the same homework assignment?
|
|
|
|
|
What if all of the names belong to the same person?
|
|
|
|
|
That's exactly what I was starting to think but the "member since" is different for all of them.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Definitely not me
I was just looking for a good practice to do it, and yes, I've mocked csv questions once before for their frequency
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
..or they could just ask each other - they're probably all in the same classroom
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Try reading this one
clickety[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Need some help regarding unsafe code.
Am trying to get create an array of pointer to a struct, and not getting through with it.
here is a sampe code
public struct RoomDef
{
public ushort Id;
public string Name;
public string Status;
public string Location;
}
Within a function i have coded the following.
RoomDef* []nee = new RoomDef();
unsafe
{
testPtr = new RoomDef();
nee[1] = & testPtr;
}
This is just a snippet of the code and there are no Syntax errors anywhere. But while I compile it gives me an error stating "Cannot take the address of, get the size of, or declare a pointer to a managed type"
Have tried using the Fixed statement as well, still no go.
I can get the address of the individual members of the structure. But not the structure itself.
Any help will be appreciated.
modified on Wednesday, September 17, 2008 8:51 AM
|
|
|
|
|
First the length of the nee array is only one, so nee[1] goes past the end. Second, testPtr is the managed type. It's already a pointer so you don't need to take the address of it.
Try: nee [1] = testPtr;
|
|
|
|
|
Thanks for the Reply,
I have handled the array part. But no, nee [1] = testPtr; does not work.
|
|
|
|
|
Alan Balkany wrote: testPtr is the managed type. It's already a pointer so you don't need to take the address of it.
No, as it's a value type, testPtr isn't a pointer at all.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I think you can have a pointer to a value type. When you make a struct with 'new' I think it's allocated in the heap. I think structs are only put on the stack when they're local variables.
|
|
|
|
|
See any work around for it?
|
|
|
|
|
I'm still looking at it. I suspect a class instead of a struct would work, but I still think a struct should work. Give me a few minutes...
|
|
|
|
|
I have tried using a class , no luck
|
|
|
|
|
This works:
public struct RoomDef
{
public ushort Id;
public string Name;
public string Status;
public string Location;
};
private void Form1_Load(object sender, EventArgs e)
{
RoomDef []nee = new RoomDef[5];
RoomDef testPtr = new RoomDef();
nee[1] = testPtr;
}
The 'struct' can be replaced with 'class' and it still works.
I suspect the array of structs is five 14-byte structures that follow each other in memory. But if a class is used, I suspect the array is five 4-byte pointers to RoomDef objects allocated in the heap.
It's hard to test this theory because using the sizeof() operator generates a compile error.
|
|
|
|
|
Thanks Alan,
But then, the code above declares an array of structures rather than an array of pointers isnt it? Correct me if am wrong, please.
|
|
|
|
|
If you substitute 'class' for 'struct' it will be an array of pointers. Classes are implemented as pointers to the data in the heap.
|
|
|
|