LizR 171 Posting Virtuoso

then do just that.

LizR 171 Posting Virtuoso

What have you got so far? We dont tend to do your work for you!

LizR 171 Posting Virtuoso

Then you need to use one of the other overloads.. such as

List<int> locs = new List<int>();
int loc = -1;
do
{
loc = wordToSearch.Indexof('a',loc+1);
if (a>-1) { locs.add(loc); }
} while (loc > -1 );

or, you could take a simpler approach and just do

foreach (char c in myString)
{
  if (c=='a') { count++; }
}

depending on what you needed.

Also - wouldnt

if(wordToSearch.indexOf("a")) != -1)

be when its FOUND the string, not when its not?

LizR 171 Posting Virtuoso

sure it can.

LizR 171 Posting Virtuoso

asp.net is code which runs on a server, dreamweaver is an editor

LizR 171 Posting Virtuoso

google is your friend.

Repeat after me

repeat
Google is my friend
until (sunk_in = true);

..

http://delphibasics.co.uk/RTL.asp?Name=TFloatFormat

LizR 171 Posting Virtuoso

MaxLength returns sizes for strings, most others are fixed sizes.

LizR 171 Posting Virtuoso

Dont hijack someone else thread with a almost non similar question just coz it has the word "web" in it.

Start your own.

LizR 171 Posting Virtuoso

sure, use and and set the values accordingly. Assuming you understand binary logic.

LizR 171 Posting Virtuoso

well a matrix is made up of a number of numbers.. simply write them in turn and then when you read them back, read them the same way as you wrote them

LizR 171 Posting Virtuoso

have a look in the rest of this forum theres a bunch of threads about printing PDFs and probably the simplest is to use adobe to do it for you.

A driver would need to know its a PDF file to print, not just get the text of the PDF.

LizR 171 Posting Virtuoso

type the word thread, and hit F1, it has some nice examples.

LizR 171 Posting Virtuoso

no, create a thread in your code, to do the whole PDF printing part. Your app then doesnt hang in any shape or form, and it can wait as long as it likes. And finally when its done, and either succeeded or failed, your thread can report back wether or not it failed. But your app can do other things, and in fact do more than 1 at a go.

LizR 171 Posting Virtuoso

If you threaded off that code, your app itself would not "wait" just that thread.

LizR 171 Posting Virtuoso

when you say its overlapping - what exactly is it overlapping? do you even mean overlapping? Please explain more clearly your issue as at the moment its not clear at all. If necessary, draw a picture or take a screen shot or something and use pointers and point out what you're getting you're not expecting.

the code I gave will only draw the picture for the current cell,and do normal behavor for all others, so I dont understand what the rest of your post is on about..

Please explain more fully and also explain what you've done to try and fix it.

LizR 171 Posting Virtuoso

You could thread off the PDF creation and so your UI doesnt "wait" for minutes.. and have an event for it to call at the end with success/fail

LizR 171 Posting Virtuoso

I just noticed it pasted it funny.

That drawcontents should be just before the handled line not the first. Otherwise yes the background ovewrites it but you would have noticed that..

LizR 171 Posting Virtuoso

Um

take a look at the events one kinda stands out.

LizR 171 Posting Virtuoso

Might depend a bit on what the USB device is.

LizR 171 Posting Virtuoso

yes you can, and with a small amount of imagination it was very obvious and very simple. In fact MSDN shows almost how to do it, it shows how you draw something for a given cell and it took me like 2 minutes of my life which I bothered to do.

And you guys wonder why I get narked? Tiny amount of reading of msdn.

where b is a bitmap loaded in or such.

e.PaintContent(e.CellBounds);
            if (dataGridView1.CurrentCell.RowIndex == e.RowIndex && dataGridView1.CurrentCell.ColumnIndex == e.ColumnIndex)
            {
                e.Graphics.DrawImage(b, e.CellBounds);
            }
            else
            {
                e.PaintBackground(e.CellBounds, true);
            }
            e.Handled = true;
LizR 171 Posting Virtuoso

oh and in the original code there doesnt appear to be a loop..

LizR 171 Posting Virtuoso

So the direction I just gave was missd.

Run.[it] commented: Absolutely clueless!!!!! +0
LizR 171 Posting Virtuoso

Well if you read so many of the other threads, next to no one seems to bother reading they just want answeres on a plate - you mention nothing of what else you tried we cant mind read, so, how are we to know?

So, your symptom is you can only connect once, this is useful to know.

Chances are then you dont have a loop listening for connections. We'd need more code to show that. Which would explain only the 1 connection.

That whole section should be in your thread, the whole listen and connect parts.

LizR 171 Posting Virtuoso

No that would just call server.start

For future reference you should say in what way it doesnt work. What debugging showsd you, what else you tried...

The arguably best way to do it is to make your own server class, where it runs a thread, it has events to say to the rest of the app something happened, and to take input and send it when it can..

theres quite a few threaded server side examples on the net, just make sure you create and maniuplate your server object within the thread.

Run.[it] commented: Thanks anyway. +0
LizR 171 Posting Virtuoso

OK, its easier for us, if you tell us what you've read and tried so far. And if you dont know any c# why you picked it, and if you've coded anything else..

Google is the fount of all knowledge.

LizR 171 Posting Virtuoso

OK, so, as its your coursework what have you covered in terms of files?

LizR 171 Posting Virtuoso

Yep, casing sucks sometimes when it bites you, but it is a good thing overall.

LizR 171 Posting Virtuoso

I really enjoyed that approach and thought it would be the same with programming - but it turns out it isn't. I guess programmers are working more on their owne then in teams.

Nope, Just it will be rare to find an online project where they will carry someone who hasnt a clue yet. Most projects want people who can get coding and up and running. There are exceptions of course, but, at least if you have good fundementals in the language you've chosen before you start, the team are more likely to want to hear from you.

LizR 171 Posting Virtuoso

Leaping into someone elses code is always harder than starting your own, sure find an interesting project to join, but, before you actually join in and commit, try and work on some of your own that will be relevant

LizR 171 Posting Virtuoso

Work through the returned data setting the appropriate labels

LizR 171 Posting Virtuoso

You could probably bundle it in another bit of unmanaged code to take the data and write it to file using c/c++/delphi etc, and have it send a message to your app to indicate picking up of a file..

LizR 171 Posting Virtuoso

It still seems mighty odd that 131 would be a valid point in memory, thats extreemly low, even for a device driver.

The other thing that seems to stand out is your lpdata should be an array surely? its a single byte..

LizR 171 Posting Virtuoso

131 seems an unlikely answer for the pointer however, lets assume it is.

if lpdata = prtdata whats the point of making a second pointer? Why not use the one you have.. Perhaps this is part of the issue.

Marshal.Copy(lpdata, VoiceBuffer, 0, Convert.ToInt32(dwDataLen));

however, still 131 strikes me as a bad pointer.

LizR 171 Posting Virtuoso

I would be useing measurestring before drawing the first - what if the space was not sufficient for the word you have? You also dont need to measure it word by word, pass the whole string.

Assuming your font properties were all set, I wouldnt expect noticable white space, in fact, quite the reverse.

To get things base aligned, you have to use a little imagination and work out using some mathmatics. Best way for you to work it out is to draw 2 rectangles on paper give them abratrary heights and widths but sufficient to pretend they are the cells on your screen, then take smaller height values, and work out how you would know where to place the top to get the bottoms the same.

LizR 171 Posting Virtuoso

OK, that reads like your course work. What part specifically are you struggling with - and what do you have so far?

LizR 171 Posting Virtuoso

LizR you sure you are meaning pinvoke?

Darn it, its what comes when Im mid code and doing something else .. (and then go out to do something) sigh - see previous version where I kept saying textbox not textbook.. :(

Yes, I meant invoke. The silly part is, if you try calling the UI from a thread, it would have told you in the helpfile what to do when it crashed..

LizR 171 Posting Virtuoso

Something you could have read up on for yourself, but decided it would be far easier to have someone else do it.

LizR 171 Posting Virtuoso

You have to update components by calling them with pinvoke - theres some great examples that come in your helpfile

LizR 171 Posting Virtuoso

Well normally you would do this by rather than using an array you would have an array of objects where on getting the value you retrieves the current value.

LizR 171 Posting Virtuoso

Thats not really what I asked the only answer you gave me was dwdatalen ..

What were the values..

LizR 171 Posting Virtuoso

What are the values of:

ptrData, VoiceBuffer, lpdata and dwdatalen before you hit the marshall line?

LizR 171 Posting Virtuoso

As you say, a lot of it is dependant on the app. If you have a huge system with modules, and reporting, and options, and potentially even client specific based chunks, and all that.. Id probably split the classes like you outlined above if not more so..

However, for general terms,

<company/codernickname>.<app> ..

I tend to have

core <- would be the GUI and front end related
classes.x group by function, so maybe db, controls, graphics
shared <- this one ive used a fair bit if Im using libraries or want functions to be available to other apps, so they are clearly the ones to use.

dickersonka commented: Very nice organizational method +2
LizR 171 Posting Virtuoso

Ah!! I could have sworn your code showed it inside the loop (I did remember saying create a variable in the loop)

Well, happy now.. Dont forget to mark it as solved

LizR 171 Posting Virtuoso

Firstly I think you need to look at why you dont want it to be data bound - why you cant use a simple query to return the unique values you need in that list and bind it..

So, *why* not?

LizR 171 Posting Virtuoso

Its been pointed out to me i wasnt awake enough when I replied earlier - I apologise for my major typos as I head textboxes on the brain, and the rest are plain typos and dyslexia.. sorry.

LizR 171 Posting Virtuoso

ok. If it works for 1 record but not the others, theres most certainly something going wrong.

LizR 171 Posting Virtuoso

If I could purswade you off a text box and to a VTM I could point you in the direction of some (in my opinoin) really awsome training videos which are cheap IMHO for the amount of time and fun you will have and how much c# and so on you will learn - as a C coder if you've done c++ the whole OO part is explained very well and it is something you can listen to as well as watch and join in. While the original premise of the VTMs was aimed at XNA - which is a game writing foundation, and its purpose is game based the premises you learn will arm you well for an awful lot of what you may come across in c# apps ..

You can find them at 3d buzz

PS microsoft also have released a number of VTm style training courses - as well as there are a number of online text based tutorials.

Personally I like the wrox c# book as training, and would recommend that if you really want a book book.

LizR 171 Posting Virtuoso

OK

its working for me so theres something odd going on.

I made 2 forms, (I didnt rename anything its a hack its ugly and you just have to go with it)

first form is blank!
second form has 4 buttons on
and the following code

private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("button1");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show("button2");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("button3");
        }

        private void button4_Click(object sender, EventArgs e)
        {
            MessageBox.Show("button4");
        }

So..

My code then in the creation of form1 was..

Form2 f2 = new Form2();
            f2.Show();
            foreach (Button b in f2.Controls)
            {
                Button x = b;
                Button nb = new Button();
                nb.Name = b.Name;
                nb.Parent = this;
                nb.Top = b.Top;
                nb.Left = b.Left;
                nb.Height = b.Height;
                nb.Width = b.Width;
                nb.Text = b.Text;
                nb.Click += delegate(object ssender, EventArgs se) { Text = ((Button)x).Text; x.PerformClick(); };
            }

So
on running, I get 2 forms, both with 4 buttons

If I click button4 on form1 (the button made on the fly) it pops up button4, just like it would if I had clicked button4 on form2, similarly i get button1 if I click button1.

So the process should be working as I described. and expected..

Make the test app for yourself, it should work..

LizR 171 Posting Virtuoso

Hmm, I get what they said, but thats not entirely true. As a new variable is created each time the loop goes through - which is why the variable had to be inside the loop not outside - otherwise Id wholeheartedly agree.

For example:

Crearte an empty app
Create 2 buttons
Create an edit box

in the event of the first button do

String a = textBox1.Text;
button2.click += deligate (object ssender, EventArgs se) { messagebox.Show(a); };

enter a click button1, enter b, click button1

click button2

you'll now get a and then b in messageboxes. thus showing that the variables stayed within the anonymous methods.

Im almost possitive ive used this to keep hold of random objects

Im now at work I got a bit of stuff to do - as much as you guys might find it funny, Im not currently employed as a developer :P I have been, was for many years, but not currently.. I do something else. It needs doing, and after all they pay me to do it..

You give that a go, and see what I mean, and I'll try and work out a way round it.. There has to be one!

LizR 171 Posting Virtuoso

I cant express how angry you make me.

If you are incapable of changing the value of a variable or setting a variable to a value and your home work is to do th is.. You are on the wrong course.