Diamonddrake 397 Master Poster

If Ramy's way works for you, then best of luck, but as for the original post. The problem with using the background worker was probably that whatever dll control you were using expects a drawing surface and you weren't supplying one, possible, In not familiar with this frame grabber, which makes it harder to help, more importantly the objects you were using in the background worker would have to be passed to the background workers dowork event handler via an object in the DoWorkEventArgs. So the code for your background worker is not correct.

What ever the control famegrabber is needs to be instantiated inside the dowork event handler, or a function that the event hander calls, all the code must not interact with anything from the original code. so essentially the code in the dowork event handler needs to be complete, as in like it was its own stand alone style application, so it would instantiate a new object of the control, pass to that whatever collection or file name you needed, then add that data to a new collection, or a save it to a file, then pass that info back to the work completed event via the e.Result property.

many programmers think one day they are just going to hop into multithreading applications and don't' realize how much trouble it can cause. Its actually difficult. and the .net threading class makes it almost too easy. making it seem that less is going on that actually …

Diamonddrake 397 Master Poster

u did not attempt to help solve my problem. So strictly speaking u shouldn't comment. Anyway your comment is not required in this context.

By the way, i have found the way to do it. Thanks all for helping me out.

What I was trying to help with is the etiquette for using this site. If you pay mind. most forums, including this one, implement a DYOHW clause, that is to say, If you don't show an effort, you won't get very many helpful responses. the people that answer vague open, easy as google.com first page result questions, are only the board developers who either really don't know what they are doing either, or just feel really generous.

I wan't trying to shoot down you question, Im just saying, Google free .net chart lib, and you get a 200,000 relevant results. many of which are working controls that contain source code.

Example:
http://www.orbifold.net/default/?page_id=1272
first page, 3rd result.
free class, creates the charts for you, and is open source, so you can see all the code on how they make every last thing possible.

Don't be rude. I wasn't.

Diamonddrake 397 Master Poster

flash projector is an exe that plays an embedded flash file, so yes it is. and its very simple.

there are free programs that will create a projector out of any swf file.

Diamonddrake 397 Master Poster

I see a lot, but I don't know what the rest of the class is doing, so I'm not sure what the problem is, it doesn't seem to be syntax. But I recommend using a background worker class, its easier to use, and returns some handy information, plus has a simple cancelasync method.

But I don't know what the references are too, Im not sure how this program extention you are using works, but to get it to work in a 2nd thread, the user control, or dll, or whatever it is you are using should be instantiated inside the new thread, and the collection of data to be processed by it should be passed to it as an object in an argument.

Diamonddrake 397 Master Poster

OK, there is the cheeze. there is MANY ways to send SMS from C#. most of them do cost money. there are a few free ways, its just a little more complicated than it would seem.

First off, there needs to be a SMS gateway. usually done through WAP, or the internet from a GSM Modem, or cell phone.

Second way, its through a webservice API, but some company would have to front the money for this, usually free ones attatch adds at the end of your message, or log the numbers you message to for future cell spamming. There is only one really free one, and its API source code is written in Linux. and that is some site called Connel, or slomething like that. Been a while since I visited it.

Now for the one you really can use!
If you use an IPhone or Blackberry. you will notice that you can't send SMS Picture messages, haha, thats because what they don't tell you is that you are sending your sms on those smartphones through smtp. Almost every major Cell Phone provider, like ATT, Verizon, Sprit ect. has a SMTP MAIL to SMS gateway. that is free to you, if you know about it. and they don't advertise it.

Essentially. they don't give out all the info, so you will need to have a smtp server that you can use to send Email with. if you pay for internet, most likely you will …

Diamonddrake 397 Master Poster

There is no % key, so it would be hard to find it. but what there is, would be a shift modified D5 key. So you look for a combination of those keys.

add this to your keydown event:

if (e.Modifiers == Keys.Shift && e.KeyCode == Keys.D5)
            {
                MessageBox.Show("% Key Pressed");
            }

NOTE:
for the alt or ctrl key, its not necessary to check the e.modifiers flag, but when using the shift key it is. I don't know why. I have just tried with it for a while and I ended up with this combination of event data to be the only one that worked.

But there you go, Hope this solves your problem.

Diamonddrake 397 Master Poster

sorry but you missed the 7 pages of comments on that example saying it doesn't work.

Diamonddrake 397 Master Poster

you need to be connected to the net via a GSM modem. many cell phones support this feature. keep in mind though. its not free. never is. those networks are owned by phone companies. so although you can write apps that interact with their systems. ultimately you are a customer. and its no different than just sending the text from your cell. It still says it come from your phone, or whatever the number is for the GSM modem.

Diamonddrake 397 Master Poster

yeah, ramy is right. a background worker would even do for something simple like this, it would even make it incredibility simple to add a progress bar. Plus built in cancel method.

Diamonddrake 397 Master Poster

There is a C# OS system. Its called cosmos, google it. It is coded in C#. but it actually turns it into a native executable that is bootable. its in the infant stage of development. but it does work. and you can download it for free. just to test it out I created a mini OS. that simple out puts all the file names on the drive it was booted from to a console type screen. then just writes some silly lines and some of those text character pictures too. Its a Neat toy. they are looking for people to help develop it further.

Diamonddrake 397 Master Poster

I believe you mean how do you set focus to a control that doesn't exist at compile time because it shows an error that that control doesn't exist.

well its easier than you think.

private void setFocus(string txtbxName)
{
if (this.Controls.ContainsKey(txtbxName))
{
this.Controls[txtbxName].Focus();
}
}

this function takes a string that would be the name you give your text box. checks the class that owns the function for a control with that name, and if it has one, it will give it focus.

if your controls live on a container, like a panel or tabcontrol be sure to search their controls array, not the parent class. but its pretty straight forward.

it would seem to achieve such a thing, since tabstop works laterally only, that forward and down have the same effect cycling through tabstops. so you would have to do some checking, you would need to implement the previous post example, that would be subscribing to the key down events to catch the arrow keys, checking to see what control has focus, then move focus to the correct control via a similar function that I posted above. also be sure to set all the textboxes tabstop property to false, so not to cause a bug that will cause the the focus selection to become erratic. I have seen that before.

Happy Coding!

Diamonddrake 397 Master Poster

ah. you mean the label is set to autosize and if the text is too long it pushes the button off the control, and removes it from the visible control. simply set the label autosize to false, then set its size to fill the space available. it might be a good idea to set the autoelipses to true as well.

Diamonddrake 397 Master Poster

wow. there are free graph classes out there, tutorials too, if you can't find one, then you aren't looking hard enough. Also, if you found something you can't implement, you are much better off, linking us to your example, posting what you are doing, and letting us show you what you did wrong.

Simple questions get more answers, we are all busy people, we would love to help you out. but not all of us have time to write classes from scratch to answer questions.

ddanbe commented: Well said! +5
Diamonddrake 397 Master Poster

there is a way to suspend all code execution of a thread. I'm not sure how its done. but ProccessExplorer from Microsoft does it, and it lasts even after the app closes, and can only be un suspended by processexplorer or closing the app via task manager and reopening it.

So if that would work, you might want to look into that.

Diamonddrake 397 Master Poster

just google Low Level Keyboard Hooks in C# Thats the trick, but be careful. if you want to have an application process all keyevents, be sure to use something like a combination, or else you will have erratic behavior. But that's the trick, I wrote a couple of auto hot key style apps using keyboard hooks.

Happy Coding

Diamonddrake 397 Master Poster

yeah, Vista can be a real pain. the simple way per user is to just set the permissions on the folder via an administrator, but that wouldn't work in a deployment situation. What will most likely need to be done is have the program create a folder in the users documents that houses its databases. so they will be accessible. I would have it detect the version of windows that is running, if its vista, copy the database to the user folder, there after the user folder version. otherwise, continue to use is as you have already been.

Best of luck.

Diamonddrake 397 Master Poster

I am glad I could help. I never use the automated databinding. It can make things simpler, but its better to write the code, that way you really know whats happening, so you can understand it, and alter it as necessary.

Best of luck with your project, and as always, Happy Coding

Diamonddrake 397 Master Poster

I don't understand where your problem is. are you having trouble getting data from a database into a listbox? because that can be done via an adapter and datatable. or not, depending on how you want to go about it.

but what's this multiselect to build a query? what does that have to do with anything, do you mean you take data from the listbox A, concatenate it into a string and query a database? if so. that has nothing to do with how you get the data to the second list box.

string querySQL = "";//this is where you pass in you query sting
//just an example connections string
           string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="access.mdb";
//create and open our connections
OleDbConnection database database = new OleDbConnection(connectionString);
                database.Open();

//create a command, and datatable, and adapter
            OleDbCommand SQLQuery = new OleDbCommand();
            DataTable data = null;
            SQLQuery.Connection = null;
            OleDbDataAdapter dataAdapter = null;
            //---------------------------------
            SQLQuery.CommandText = querySQL;
            SQLQuery.Connection = database;
            data = new DataTable();
            dataAdapter = new OleDbDataAdapter(SQLQuery);
            dataAdapter.Fill(data);
           //you now have a full data table
           // now just loop through the data and add the rows to
           //the list box this just looks through the table for each row,
          //and if the row has an entry in the column "aColumn"
           //they are added to the list box.
            for (int i = 0; i < data.Rows.Count; i++)
             {

            string data1 = data.Rows[i]["aColumn"].ToString();
            listView1.Items.Add(data1);
             }

that should be everything you need to know (in the path of using an adapter, like VIeditorlover …

Diamonddrake 397 Master Poster

lol wow. You mean how to "skin" a form.

That can be a very complicated process and there are many ways to go about it.

you could create your own custom controls that are all drawn fancyful.

you could just overide the form's paint events and draw on the form.

you could set the forms FormBorderStyle property to "none" and then add pictureboxes around the border of you form and create a look that way...

or you could combine them all for a cheezy skin effect if you so desired.

But I warn you, creating non square forms with fancy images seems easy and fun. but its actually a lot of work. and if you intend to have nice edges or quality transparency effects, get ready to layer forms and import some windows methods. its a headache. C# wasn't really designed for fancy skins. Although its very possible.

Diamonddrake 397 Master Poster

um. What?

Diamonddrake 397 Master Poster

Thanks! I had no idea that visual studio processed the load event in the designer. That makes a lot of sense. I have learned much from you.

and it looks like its error clean, but idk. I didn't paste it, I just realized what you were getting at and edit my code to match.

Diamonddrake 397 Master Poster

wow, it worked perfect first try.

I used a modified version of your code to find the parent form, and then set the parent form's key preview to true and created a local event handler for the parents forms keydown event and it works like a charm, I now have a ready made drop in anywhere calculator control that accepts key events instantly with no additional code.

Control ctrl = (sender as Control);
            while (!(ctrl is Form))
            {
                Console.WriteLine(ctrl.GetType().Name);
                ctrl = ctrl.Parent;
            }
            f = (ctrl as Form);

            f.KeyPreview = true;

                f.KeyDown += new KeyEventHandler(this.KeyHandler);

I just put that in my controls load event, and created a higher up scope of Form f; although its apparent now I didn't need too.

But then created a function named KeyHandler and treated it as a local KeyDown event handler, and it works withough a hitch. Im loving it. only problem is if its in a tabpage after the project is built it crashes the designer in VS. and wont let you view that page of the tab... Im not sure why. But it compiles fine, and runs fine. No errors.

so it is completely possible, completely simple, and I am completely happy. I may even need to post this on codeproject. Others should know its this simple.

Cheers fellows, and thanks for all your assistance!

Diamonddrake 397 Master Poster

I just remember a while back that I wrote a form control that allowed for clean transparent edges by piling up 2 forms, one that performed a C# transparency workaround, and another that kept position center of it that held the controls. the control form created the background form and passed to its constructor the instance of the control form, then to make the background form act like the control form for example the visibility be the same, I simply used that passed instance variable to declare some event handlers of the control form in the background form,

ParentForm.VisibleChanged += new EventHandler(parentFormVisible);

 void parentFormVisible(Object sender, EventArgs e)
        {
            m_lwin.Visible = ParentForm.Visible;
        }

so I don't see why this wouldn't work, I'm going to try it out as soon as I get off work tonight.

and thanks for that code snippet. I never though I sifting through parents until you found on of the right type. makes sense though.

happy coding!

Diamonddrake 397 Master Poster

well, im not sure if it works on the end control, but it does work well on the form. just as easy as pasting it in has the exact desired effect. Thank you very much sknake.

But I can't quite call this one solved yet. but I have learned a lot on the way through. I still have my original pressing issue. I can't seem to create a simple user control that handles everything by just being dropped in. although I think subscribing to the parent event might work, I'm still unsure...

and even if it is as simple as this.Parent.event += new Event Handler(this.a local control function); does work, could you make it somehow find the top parent to really be getting the forms events and not a tabcontrol, or panels events?

Diamonddrake 397 Master Poster

ok. so there is a process command key event ? I was unaware of this, would that be declared on the end control, or on the active form?

and as I can see its an override, so I don't have to instantiate the event handler correct?

Diamonddrake 397 Master Poster

thanks ddanbe,
I the method I am currently using is handling the forms keydown and keypress events. and I do have the forms keypreview set to true. thats how I have it working now, and I am using a very similar system as the code snippet you linked to, for the handling of unwanted keypress(s) but for some reason Its not keeping the focus from changing when arrows are pressed, and nor is it keeping the return keys from activating the focused buttons, instead of just the code i intend.

What I can't seem to accomplish is that preventing, and also I would like this control to be a drop in control, that works as long as the form that contains it has focus...

With that said, Is there a way to subscribe to a parent forms events from a child control?

like...

this.Parent.keyDown += new System.EventHandler(this.CalckeyDown);

Would that work?
assuming that the parent was a form and not, like in my case, a tabcontol or panel or somthing?

When I get a chance I will create a test project and try it out, I'm just really pressed for time these days.

and living without a deadline is wonderful isn't it? If I had deadlines I would be dead from a stroke by now.

Diamonddrake 397 Master Poster

It is a wonderful language. gets it done faster, But C++ is still a better choice with no prerequisites for standalone. in sharp you can't even create a install package in good faith that it will work on end the user's computer without a native code bootstrapping.

But if you are hurting for a simple utility to help hack a video website or something, you can throw a url escape sequence converter together in 7 minutes. %3a who comes up with that crap anyway.

Diamonddrake 397 Master Poster

lol, wow. i couldn't have said it better my self. also. google search overloaded methods in C# and you get 100,000 hits. and a page of examples just on the first link. I did a test search just to be sure.

Diamonddrake 397 Master Poster

well more specifically you must cast the sender to its actual type. which is a button, then get its parent object. here you go, i will just write it for you.

public void handler1(object sender, EventArgs e)
{//create a button variable to hold pointer to button that called event
Button mb = (Button)sender;
//create var to hold its parent container, this case the 2nd tab page
string btnParentText = mb.Parent.Text;
// tp.text takes the last tabpage name n not the tabpage from where the respective button was created
test.addform(parentglobalobj, btnParentText);
}

Sorry no one helped you sooner, 2 days is a long time to be stuck.

Diamonddrake 397 Master Poster

Problem is, that the tp variable you created as a param for your create button function is not valid in the event handler.

Outside of the method, tp either doesn't exist, or refers to a variable at a higher up scope.

to point to which tab control fired the button you would want you handler to check what button was pressed using the events sender object, then check what control it lies on.

Happy Coding

Diamonddrake 397 Master Poster

simply, you can create multiple methods of the same name, that accept different params, depending on what arguments you pass to your method, something specialized occurs.

example:

public static setTitle(string s)
{
     this.Text = s;
}

public static setTitle(string s, boolean alertUser)
{
     this.Text = s;
     if(alertUser == true)
     {
         messageBox.Show("form caption changed to "+s);
      }
}

happy coding

Diamonddrake 397 Master Poster

you can view the same data set as many times as you want.

problem is... with only the description of the result of a problem, its hard to diagnose it... its like calling a mechanic and telling them your car doesn't work, then with only providing the detail that you tried to start it... you ask precisely how to fix it.

one problem you might have, is you should create an instance of the data adapter for both queries, one at a time setting them to null after each, its actually most simple to create a method that accepts a datagridview argument, and a sting argument. passing to it, what gridview to laod the data to, and what sql query to present to your database. then call them when you need them, in this case on form load.

or else, post you code.

Diamonddrake 397 Master Poster

thanks, I will post back if I find a better way to do it. but currently I'm using the form's keydown event to call internally declared event methods in the control that are also the click event handlers, and the last line of all the methods it tells the equal button to take focus, ensuring that the enter key will invoke the the equals method, But this is not a good way to go about it, and certainly not a simple drop in user control.

but it is an acceptable temporary solution, as the project I have started is large, and a convenient calculator is but on feature that I am working on.

I don't program for money, It's not my job, I'm not in school, I don't intend to rule the world, I simply am unhappy with the selection of software out there, and I intend to do something about it.

Until then happy coding!

Diamonddrake 397 Master Poster

ah. that makes sense, so a control must have focus, but what if a child control, on a control has focus?

I have a form, which contains a tabcontol, which contains a user control i have crated, the user control is a calculator that contains 2 groupboxes, on one, a textbox, and on the other a set of common calculator buttons,

if only the control with focus raises the events, there is my issues. because when my user control gains focus, it passes it on to the first button, and else afterward the last button to be focused on previously.

do I need to create a custom button control that inherits from the button class and passes its key events to its parents of type user control?

or is there a better way to go about it?

Diamonddrake 397 Master Poster

that's what I tried essentially. it just had no effect.

question,
does each control throw its own key events?

that is if I handle a key on the form, does that event still occur on a child control? because my form's keypress event handles the keys i would like to have no effect on its child controls, seems they all still weasel through.

Diamonddrake 397 Master Poster

I didn't figure out exactly how to do what I had wanted, but I did achieve the end result for my program. I ended up setting all the click event methods to internal, and calling them from the keydown event of the form.

I can't seem to handle the arrow keys though, I would like to keep the arrow keys from changing the selected control in my user control. i would prefer them to just do nothing, i tried setting a flag for all not used keys to throw, then the keypress even to check for the flag and handle them, but the arrows still don't get suppressed. any ideas?

Diamonddrake 397 Master Poster

I have written (mostly) with some take from a simple tutorial a calculator control for a program I am working on, the control works fine, except i would like the control to accept key input, like the windows calculator does, i.e. asterisk activates multiplication, enter evaluates and the numbers are number ect...

the control inherits from UserControl, and just contains the .net button controls.

since it inherits from UserControl it has the events for keyDown KeyUp and KeyPress.

the user control is contained in a tabcontrol, and is on a form that is a fixed tool window and an mdi child.

I would like for the control to accept keys when that tab is open and the toolwindow has focus. but alone, the usercontrol, even when focused the events don't fire.

I ended up just subscribing to the forms key events and calling the handlers on the usercontrol from there and just passing the eventargs on to the usercontrol, this didn't quite work... I failed to be able to handle the events so that the focus didn't jump around with the arrow keys, and the enter key just activates the focused button. also the enter key never fires any events.

I am just not sure where to go to from here. any suggestions would be appreciated.

Diamonddrake 397 Master Poster

as for "people who use other search engines"
it was just an idea, if could easily be done using browser history, or anything like that. It was more of a serious tone joke.

and as for using the keydown event.
even as shown in ddanbe's example, handling the entire key event can only be done in a keypress event! his example checks durring the keydown event but the keypress event actually handles the event and keeps the text box from receiving an input, that was my whole point. anyone that needs to ask this question in a forum needs that kind of information. if they don't know how to do, then they probably don't know the specifics such as that.

further more great snippet ddanbe.

Diamonddrake 397 Master Poster

Ddanbe has given the correct answer. When the key is pressed if you dont want it, you can do something about it then.

That would be "a" correct answer, If in program you achieve your the desired effect, it is correct. there is no "right" way to program.

although that would be one of the best ways to go about it in this programmers opinion.

one thing to remember, if you desire to use the ever popular solution to simply ask the system, if a the key is a particular character, don't do anything. its usually necessary to subscribe to the "keypress" event. not the "keyup" or "keydown" events. I ran into that problem when i first got started, some one on a forum not unlike this one helped me out because i was using the "keyup" event, and it would fail to handle the event entirely. the code would execute, but the text still appeared in the text box.

Google is your friend.
here is an example of a custom text box control that only allows digits

public class NumbersOnlyTextBox : TextBox
{
  public NumbersOnlyTextBox()
  {
    KeyPress += new KeyPressEventHandler( HandleKeyPress );
  }

  private void HandleKeyPress( object sender, KeyPressEventArgs e )
  {
    if ( !( char.IsDigit( e.KeyChar ) || char.IsControl( e.KeyChar ) ) )
      e.Handled = true;
  }
}

its not necessary to use a custom control, you could simply just do the same on your form directly.

<rant>
it can't be …

Diamonddrake 397 Master Poster

I am working on a quick launch style application. I am storing file paths, and icon captions in arrays. I am trying to keep the feel of a standalone application. So any method for saving the data should be able to be located some where relatively hidden from the user, so the application can be ran from anywhere, but retain settings and the user to be able to use, move, and share the application without locating multiple files. the arrays will be able to increase in size as the users need for more icons increases. I would also like the user to have the option to backup the data as a file that can be imported back into the application.

What method is best for saving string arrays, and also, what method would most benefit my application?

would the same XML settings file I use for basic preferences be the best candidate? or would a csv or jet database be better served?

is there some other method besides those listed have a better effect?

Diamonddrake 397 Master Poster

Visual C# Express is free

Indeed. I can't argue with that, but still many programmers don't use Visual Studio.

Diamonddrake 397 Master Poster

only problem with this teach a man to fish deal you have running is that not everyone has Visual Studio, some people are compiling using free software with no help files, and online help from Microsoft is practically Japanese to a weekend programmer.

But I do understand, although i understand things best with an example, simply searching for an answer to this problem in google yields the exact answer in the first result by just searching "mid() in C#" http://www.csharphelp.com/archives4/archive616.html but manytimes i have been searching for some help on something and had to waste my time reading forum posts that were top search results that don't answer me at all.

so I am undecided, sometimes I just don't know where to go, and I have no code to post.

further note, that link is a good one, it shows how for someone accustomed to VB style left, mid, and right functions to reproduce them in C# so they can even still be called using left, mid, and right respectfully.

Live and Dream in code my friends.

Diamonddrake 397 Master Poster

you weren't to specific, but i am going to assume you are going for the internet explorer7+ and firefox style search box where the search box is a separate text box, this code would imply that you have a webbrowser control called "webbrowser1" and a textbox for the search called "searchTxt" and this code would be in a click event method for a search button.

string breaker = " ";
         char[] delimiter = breaker.ToCharArray();
         string[] splitterArray = searchTxt.Text.Trim().Split(delimiter);
         string queries = "";

         foreach (string s in splitterArray)
         {
             queries += s + "+";
         }

         //remove extra plus at the end of queries
         queries.Substring(0, (queries.Length - 1));

 webbrowser1.Navigate("http://www.google.com/search?q="+queries);

first we create a delimiter to separate the search terms for use on google, this would also work for yahoo, and wikipedia, and many others you just have to check where to put the queries and get the search url from their site this is set up ready to work on google

then we take the string from the search text box and separate it by spaces into an array, after that we loop through the array and add all the search words together into one string adding a + between each one because this is the format that google and yahoo both use.

then we use substring to remove a + that is added at the end that is unnecessary, this could have been avoided, but this is a simple and effective solution, so we will go …

Diamonddrake 397 Master Poster

what you have to do is remove "using System.IO;" from the top of your class, and everytime you need to use System.IO.File you will have to type the full namespace. problem is that when you import the namespace for the object that creates your shortcut you share its namespace scope with the "File" namespace scope of the System.IO, so removing the using block at the top of your class fixes the problem.

Happy Coding!

Diamonddrake 397 Master Poster

I like to use a slight variation, just modify your entry point as follows

static void Main() 
		{
            string proc = Process.GetCurrentProcess().ProcessName;
            Process[] processes = Process.GetProcessesByName(proc);
            if (processes.Length > 1)
            {
                MessageBox.Show("Application is already running\n\nOnly instance open at a time.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Application.EnableVisualStyles();
                Application.Run(new Form1());
            }
		}

users can get around it, but its very handy if you just want to keep accidental multiple instances from occurring.

some of those others are just as well.
Cheers.

Diamonddrake 397 Master Poster

Is it possible for you to post the code you used?

I am struggling to do this as we speak, but can't get it to work.

Thanks in advance.

Schokbreker

I found many ways to get the lines to the arrays, but the way that seemed to work the best for my application was to create some string lists add the values to the lists and then convert them to arrays sort the first using the 2nd as a key. then send them back to your text field or where ever you want them.

Its a TON of code that i worked very hard on, and it works great for 100,000 lines or so, but get over 250,000 lines and you tend to get memory errors.

I will give you a simple fly by version

try
            {
//create some string lists to hold your lines

                List<string> mySortLines = new List<string>();
                List<string> mySortLines2 = new List<string>();

                //declare a variable to hold the lengh of the first line
                int int4length = 0;
                int X = 0;
                
//create a string reader to read in the lines of text from RTB (txtMain)
                using (StringReader r3 = new StringReader(txtMain.Text))
                {
//create some vars to hold the selected text (on the first line) to show what column to sort by.

                    string txtSortLine;
                    int txtSelectedStart = txtMain.SelectionStart;
                    int txtSelectedLength = txtMain.SelectionLength;
                    string txtSortcharacter = string.Empty;
//if no text is selected, abort and show error message
                    if (txtSelectedLength == 0)
                    {
                        MessageBox.Show("you must select characters …
Diamonddrake 397 Master Poster

pm me your email addy and I will send it to you as an attachment.

Diamonddrake 397 Master Poster

the data I am using is a data file from a fiend of mines employer, it was the only suitable file for testing, and I am afraid it is confidential. but its just a large csv file. the code for the sorting method I posted here. all i can tell is that i need to use external sorting to handle large files. but i can't see to find any information on how to implement it.

Diamonddrake 397 Master Poster

I have hit a slump, my line sorting text program runs out of memory when sorting large files, the answer is using an external merge sort. basically it breaks the file into chunks, sorts them, then loads chunks of the chunks, and sorts them, then some how comes up with a fully sorted file.

I have searched the internet, with multiple search engines, for hours the past couple of days. I can't seem to find any help what so ever on this topic, I have found facts that it exists, its purpose reiterated hundreds of times, but no information on how to do it, not even a link to a book I could buy.

Im not a student trying to cheat, or a developer trying to make millions on a program. I write freeware apps, and this one is being created out of necessity, for myself and some of the company I keep.

Please Help!!!

Diamonddrake 397 Master Poster

this

String fileNameOnly;
fileNameOnly = System.IO.Path.GetFileName((openSingleFile));
fileinfoViewer.Items.Add(fileNameOnly);

should be

String fileNameOnly;
fileNameOnly = System.IO.Path.GetFileName((openSingleFile.FileName));
fileinfoViewer.Items.Add(fileNameOnly);