LizR 171 Posting Virtuoso

I did mention it would have to map its own :) but it should also have code in case that drive disconnects (such as something goes wrong)..

If your app runs as a service, and is set to autostart, it would run on startup.

LizR 171 Posting Virtuoso

How did you define the MyEvent type?

the UpdateText method looks reasonable, it would seem more likely it didnt get called.

LizR 171 Posting Virtuoso

No, you can have a large number of threads running at any time, although actual activity is limited and timeshared over the available CPU power of your box.

eg, if you have a single CPU with HT - thus pretending to be 2 CPUs directly technically it does only 2 things at a time, however with fancy timesharing by windows it will appear more than 2 threads run (for example take a look in task manager and see how many processes there are, let alone if you use something like sysinternals process explorer and see how many threads per process)

OK, as a rule a service should not make windows or write to consoles - as a lot of the server versions of windows are either set not to, or dont by default allow it

Other things to remember when making a service is that if you as a user map a drive, the service cant see it, even if it runs "as you" .. it has its own instance, and wont see any mapped drives, it should do its own.

As you're making some form of net monitoring system, a text file is possibly not a good place to keep things, as the more servers you get the more likely you are to run into file locking issues.

The key facts are however, for all the threads you start you must terminate them.. and handle any issues within them.

LizR 171 Posting Virtuoso

OK, so now Ive eaten my dinner - and I got 30 mins before I go out:

Picture this.

You have a routine on your first form, which you assign to an event on your second form - such as a routine like:

public UpdateText(String msg)
{
  this.textBox1.Text=msg;
}

If your event is programed to receive such a thing, you could easily on creation of your second form do

form2.MyEvent += new MyEvent(UpdateText);

then within form2, on clicking of button you can test

if (MyEvent!=null) { MyEvent("testme"); }

and you just triggered your event..

another way to do it is to have

void DoMyevent(String msg)
{
if (MyEvent!=null) { MyEvent("testme"); }
}

and then when you potentially need to call your event do

doMyEvent("sometext");

and your code is easier to read


Just read up on delegates and events.

LizR 171 Posting Virtuoso

have you considered setting a property on form2 to be the value of form1? so you have a reference?

LizR 171 Posting Virtuoso

You can either make an event on your main form which you tie into the button on your second form (messier)

or

You can create a method which you send the data from your second form, to your first form. So the first form handles all its updates.

LizR 171 Posting Virtuoso

You said it wasnt working - it cant be good enough if it doesnt work, can it?

So, your new code, how about letting us have the error code you get, rather than trying constantly to recreate half an application to duplicate the need for the code you have?

LizR 171 Posting Virtuoso

I think your stored procedure needs more tweaking - the info can be found at .. http://msdn.microsoft.com/en-us/library/bb546186.aspx

LizR 171 Posting Virtuoso

The problem would seem to be

return ((int)(result.ReturnValue));

In old days thats probably a pointer to the result, but in .net youve told it to be an int, so an int it is.

Try changing it to

return ((IEnumerable<Order>)(result.ReturnValue));
LizR 171 Posting Virtuoso

If your exchange server supports SMTP mail connections (which most likely it will) you would just change your app to point to your exchange server

LizR 171 Posting Virtuoso

Dunno I never asked a question here, I assume theres a button to say "resolved" somewhere.

LizR 171 Posting Virtuoso

No worries.

LizR 171 Posting Virtuoso

if you look at:

until (call_start >= 0) or (call_start <24);
      repeat                                  //repeat 2
        writeln ('please input call length');
        readln (call_length);
      until call_length > 0;

You have an until without a repeat. Hence you get a confused bit.

LizR 171 Posting Virtuoso

Learn SMTP its really easy.

LizR 171 Posting Virtuoso

OK but you're reinventing the wheel thats already included in the smtp which comes with .net

LizR 171 Posting Virtuoso

It shouldnt do not in the database you selected it from. Assuming you have indexes 30k records should be processable in a matter of 1 or 2 seconds.

Im thinking your selection code needs tweeking as the DB should do the join, which is why its slow.

it should go something more like

str1 = "
select * from dbo.Executive inner join Retailer on Executive.ExecutiveCode = Retailer.salesExecutiveCode"

which should join your 2 tables in 1 big grid, if you then only need 1 value such as retailercode, then add the "where RetailerCode='00000949'" to that original selection..

Not only have you then only downloaded the records who matched the criteria, you've made the potentially remote server do all the work not your app.

LizR 171 Posting Virtuoso

Didnt really answer my question, are you talking pop, exchange, imap, smtp? If so, next to all thats already premade..

what do you need your library to do thats not covered?

LizR 171 Posting Virtuoso

depends what you mean by mail library. a lot of commands are made for you and built into the frame work.

LizR 171 Posting Virtuoso

why not just do a joined query on the server, its much more efficient

LizR 171 Posting Virtuoso

What errors do you get? Id suggest make a new winforms app, apply the code there, and if that doesnt work, please post all the code so we can see, as well as the errors if any.. If there are no physical errors, please describe what you're seeing (or not seeing)

LizR 171 Posting Virtuoso

Perhaps you should add rows to your D1 dataset?

LizR 171 Posting Virtuoso

unfortunately ping is often blocked and is also the loweest priority of network traffic, its the first thing to die. Round trip time isnt a good judge as just coz its closest doesnt make it fastest.

LizR 171 Posting Virtuoso

Kil the whole application doevents bit, thats a sure way to tie yourself in knots.

Have a list items you've queued up to go, fire off 5, as each of the 5 finish, take the next one off the queue and start a new thread. until you have nothing left in the queue.

At the end of each threadrun, issue an event to say "A thread finished, heres the result" ..

LizR 171 Posting Virtuoso

download a test file and compare times?

LizR 171 Posting Virtuoso

Doesnt make any difference. Most likely your desktops on drive C anyway.

Run.[it] commented: cheers +2
LizR 171 Posting Virtuoso

Good example comes in the help, just look at Console.ReadKey

LizR 171 Posting Virtuoso

Ah you mean to minimize not close.. now it makes sense.

LizR 171 Posting Virtuoso

or use the readkey function and while its not Y or N.. keep reading.

LizR 171 Posting Virtuoso

Would not the row index be higher than the record count?

LizR 171 Posting Virtuoso

I showed you that code.

LizR 171 Posting Virtuoso

I see what you mean in someways, however, either way you end up with some kind of loop.

if you wanted to change your code so you dont do something like

if (textbox_from_1.Text == textbox_to_1)
if (textbox_from_2.Text == textbox_to_2)
if (textbox_from_3.Text == textbox_to_3)

etc, you would still end up with a loop
i guess you have tried the obvious of such as :

for (int i = 1; i<3; i++)
            {
                if (TextBox)Controls["textbox_from_"+if.ToString()].Text == (TextBox)Controls["textbox_to_"+if.ToString()].Text)
            }
LizR 171 Posting Virtuoso

Well, it depends a little on how you made those boxes, if they are premade on your form, then you'd know the names before you started.

if they are generated, you could make an array of textboxes, and just walk the array of text boxes..

LizR 171 Posting Virtuoso

in a way all c# stuff is pointers as everything (including integers etc) are objects, but at the same time, you basically ignore that. So yes, it can be confusing from a c++ point of view.

LizR 171 Posting Virtuoso

Firstly if you did a correct selection from the db, it would return 1 line that matched or 0, it shouldnt do it for all users in the db.

Secondly, if you created a flag to equate to "found" or "not found" you could then deal with it at the end. So even if you did have multiple entries loops through for some odd reason, you would only display one message.

LizR 171 Posting Virtuoso

OK so when the location changes, clear and populate the floor combo with items that match.

LizR 171 Posting Virtuoso

Sure walk through all the components of a form checking to see if their of type textbox.

LizR 171 Posting Virtuoso

Create a boolean variable, thats a "flag" as its yes or no.

LizR 171 Posting Virtuoso

If you dont enter any it doesnt find a record in the db so no it wont show a message (debugging would show you this as the records returned would be none)

set a flag at the top of the routine to false
if you get a valid login, set it true, if its still false when you get to the bottom then they didnt have a valid id

LizR 171 Posting Virtuoso

You dont need to send I at all.

LizR 171 Posting Virtuoso

heres some psudo code
begin
split string get bunch of chunks
define output area
dostuff(chunks)
end

proc dostuff(chunks)
take first chunk
for all the bits of last chunk
for all the output areas
make a copy of current output area + bit
dostuff(chunks - current chunk)
end

LizR 171 Posting Virtuoso

So, you need to split the string into chunks and work by value, and then go from 'start' to 'end' for each one.

LizR 171 Posting Virtuoso

You havent explained the problem of the last row, the reason I wonder about -1 is becaue of the 0 based array/list properties.

What is the error you get? Is there any other code you have around that line?

LizR 171 Posting Virtuoso

Sure you want RowIndex? not RowIndex - 1?

Whats the error and did you really need to spam so many different questions, as they are all based around the same subject.. you could have placed them 1 by 1

LizR 171 Posting Virtuoso

usually its ^H or ^? but not always they often are backspace, best way is to grab all characters on a press and see what you get - although it would seem a bad way to test for a delete key

LizR 171 Posting Virtuoso

and at which line (just to be sure)

LizR 171 Posting Virtuoso

Why not? what error does it give?

LizR 171 Posting Virtuoso

Surely it has an equivelent of "My documents"?

LizR 171 Posting Virtuoso

As long as the lines are unique you would need to either use a dictionary and sort an array/list of those characters being the key to the dictionary, OR, you need to write your own sort routine.

LizR 171 Posting Virtuoso

I dont see why you'd be having a problem the following

List<String> lines = textBox1.Text.Split('\n').ToList();
            lines.Sort();
            textBox2.Text = String.Join("\n", lines.ToArray());

With

"a cat
a bat
a mat"

put into textbox1, sorted it correctly

LizR 171 Posting Virtuoso

Have a read on IDisposable - that will cover the disposal comment

The stringlist would be part of your new class you made from IDisposable, so that when it goes you can itterate through the things you need to do..

You then add to the list each time you change the image reference, to place the old unwanted item on the list for removal when its all over.

reaven commented: thanks for the help +1