|
It's exceedingly primitive, but combinations of System.Debug.Trace.WriteLines in conjunction with calls to System.Environment.TickCount have always served me well...just grab the tickcount into a long variable at the beginning of a method, and difference it with the current tickcount at the end of the method, then dump the output to the trace.
Jeremy Kimball
|
|
|
|
|
|
|
Ive downloaded this sample prg trying to get started with C# and directsound
http://www.c-sharpcorner.com/Code/2003/Jan/DotNetPiano.zip
Ive installed DX runtime 9.0 and SDK
I use MS V .NET 2003
I can see that .NET does not recognize the DX installation. It simply cannot reference the DX libraries.
How can I make this work?
|
|
|
|
|
The only way I got it to work was copying the DX9 assemblies out of the GAC and referencing from there. Of course, Windows Explorer doesn't allow copying out of the GAC; I had to use the command line to do it. :P
The graveyards are filled with indispensible men.
|
|
|
|
|
I have a combobox and I can't get it to display the selected value when i load my form :
I am manually populating the combobox rather than using comboBoxCFMName.DataBindings.Add
Saving works fine i.e. if I select a value from the combobox, everything will save back to the database but when the form is refreshed, the combobox doesn't display the value from the database. I have tried manually setting the combobox.SelectedValue, combobox.SelectedIndex and even combobox.Text (even a refresh), but none of them affect the value displayed in the combobox - it still displays the first value in its datasource. I have pasted the code below ...
/*-----------------------------------------------------------------------------------------------*/
dataViewRE.Table = DataSet.RE;
comboBoxName.DataSource = DataSet.CFM;
comboBoxName.DisplayMember = "Name";
comboBoxName.ValueMember = "ID";
if (dataViewRE.Count > 0)
{
comboBoxName.SelectedValue = dataViewRE[0].Row["ref_Name"].ToString();
// actual text that will be visible to the user of the combobox
string refName = DataSet.CFM.Select("ID = '" + dataViewRE[0].Row["ref_Name"].ToString() + "'")[0].ItemArray[1].ToString();
// index of the location at which the displayed text is stored in the combobox list
comboBoxName.SelectedIndex = comboBoxName.FindStringExact(refName);
// set the text of the combobox to the string to be displayed
comboBoxName.Text = refName;
comboBoxName.Refresh();
}
/*-----------------------------------------------------------------------------------------------*/
Any help appreciated ...
Thanks
Eco
|
|
|
|
|
I had a similar issue with the DropDownList and was able to set the SelectedIndex in the PreRender for the control.
I hope this helps.
|
|
|
|
|
Hello,
lets assume i have a filled ArrayList and want to print the content on a printer. How do i do this ?
Thank you for your assistance
Regards,
Peter
|
|
|
|
|
It depends on what you filled the ArrayList with. Do you want to print Strings?
//get printer settings
PrintDialog dlg = new PrintDialog();
dlg.Document = new PrintDocument();
dlg.Document.PrintPage += new PrintPageEventHandler( YourPrintMethod );
if(dlg.ShowDialog() == DialogResult.OK){
//start printing
dlg.Document.Print();
}
private void YourPrintMethod(object sender, PrintPageEventArgs e){
//loop through the array and print the objects
foreach(object obj in yourList){
e.Graphics.DrawString(...); //draw the object
}
}
|
|
|
|
|
Hello Corinna,
thank you for your help. Yes, i want print strings.
What do you mean with the three dots in
e.Graphics.DrawString(...); ???
Regards,
Peter
|
|
|
|
|
Graphics.DrawString is overloaded, there can be different parameter lists.
This is the easiest one:
SolidBrush brush = new SolidBrush(Color.black);
int verticalPosition = 0;
foreach(String s in yourList){
verticalPosition += this.Font.Height + 5;
e.Graphics.DrawString(s, this.Font, brush, 10, verticalPosition);
}
|
|
|
|
|
Hi Corinna,
thank you very much, this works fine.
Regards,
Peter
|
|
|
|
|
i am a C++ coder who recently made the conversion to C# (with which i am very pleased)
and yes i get it the list and and array list and all of that stuff is under System.Collections but i want to know if there is anway to make them return anything other than object
for instance if i have a multi level vector... er arraylist how can i make it so that i can say:
fu[i].bar[j].symbol = 6;
ok its not a real example but it is something that i would like to be able to do
i played with the get type function since it will return something's original type (before casting to say object) but it requiers a ';' after it so that didn't work (example of what i hoped would work ...
get {return (array_name[index].getType())[index];}
...)
but anyway if anyone has ideas feel free to share
Hope is denial of reality
-Raistlin Majere
Your ticket to the future is always blank
-Vash, Trigun
Once the picture is crumpled up it can't be perfect again
-Forgotten, Linkin Park
|
|
|
|
|
vylkier wrote:
but i want to know if there is anway to make them return anything other than object
Just create a new collection class inherited from CollectionBase, and set its method data types to the data type you want.
vylkier wrote:
for instance if i have a multi level vector... er arraylist how can i make it so that i can say:
fu[i].bar[j].symbol = 6;
ok its not a real example but it is something that i would like to be able to do
Hmm... I don't quite understand what you're trying to do here... are you wanting to be able to access the object through its own type rather than through the object type? If so, then the method above will work well for this.
vylkier wrote:
i played with the get type function since it will return something's original type (before casting to say object) but it requiers a ';' after it so that didn't work (example of what i hoped would work ...
get {return (array_name[index].getType())[index];}
...)
Hmm... that should be GetType() not getType() . Other than that, it should work, except what's that extra ')' for?
|
|
|
|
|
vylkier wrote:
but anyway if anyone has ideas feel free to share
I think what you are looking for is generics[^]. HTH
-Nick Parker
|
|
|
|
|
Is there a way to put one line of code into two lines. Say for instance I had a huge line of code and it goes way off the right of the page, is there syntax so that I could make it go to the next line.
|
|
|
|
|
Yes, try Enter
static
void
Main
()
{
System
.
Console
.
WriteLine
(
"hello"
+
" "
+
"world"
)
;
}
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
It's that easy eh,just wasn't sure. Thanks!
|
|
|
|
|
Well, in C# the end of the statement is signaled with a semicolon, so you should be able to span a statement across multiple lines. Can you show an example of a huge line?
|
|
|
|
|
in visual studio you can use "Word wrap" under "tools, options, text editor, all langs, general"
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I wrote a class that i can essential use any where for any of my Inet enabled applications. It serialize's/compresses/encrypts objects and sends them over a net work were it will rebuild it and return the object. it works great but my problem is, i am writing a Chat/File sharing application..it works fine...but i love to criticize my own code and think of how i can make it more efficient, but my lack of experience in developing internet applications and data packets to send is really leaving me stumped. Could anyone help me and point me in the write direction ? i want the system to be as Secure as possible despite the fact that the objects are already encrypt. Anyways thanks for baring with me here...
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
If it Serializes, Compresses, Encrypts and Sends an Object over a network... then it should be 4 different classes
|
|
|
|
|
it is,..encryption / compression namespaces/classes (rsa,tdes,rc2) and a listener class and a recieving class. I just dont know what type of object to send. I want my program to be secure as in...the use is notifyed that someone wants to send a list of there files, I want the other user (requester) to recieve a encryption key that only they can use to encrypt those files. i have that working and all but i was wondering if there were any examples anywhere on how other people accomplish such a thing ?
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
Do you mind if I ask why you aren't using .NET Remoting?
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
Well i found from school that using .net remoting can do the samething but i want the raw power of sockets. knowing who is connect when/where/there IP, i assume you can write this into all of your objects and do the same with remoting, but why re-invent the wheel ? and for some reason even though i spent alot of time with remoting in school i seem to beable to use Asyncronous Sockets alot easier, they just make sense to me. And i have alot of power on how i recieve the objects, for example..in my recieving callback i have a stream write the recieved bytes to a file so it doesnt hog up my memory while it waits to download all of the object. This saved alot of memory because sending files encapslated in a class are very large, my socket recieves every connection and give it a unique output and saves the reieved bytes to that output. The unqiue output dir is saved in my state object in my recieve callback and i just reuse that same state object the next time around. Once the object is fully downloaded i move on and decrypt the saved bytes, decompress / reserialize, and the other user recieved it fine. Deep down inside the remoting calls uses sockets as well...although the remoting classes are more user friendly and by all means not dumbed down at all. (it also generates the sockets for you on the fly...which is awesome)
Jesse M.
The Code Project Is Your Friend...
|
|
|
|