|
Luc Pattyn wrote: So I still need to figure out why your snippets are harder to copy
wiht formatting than most others... (that's with IE6/IE7 towards Visual Studio).
I'm posting this from Firefox. Let me know if the code below has any additional tags added.
fixed(float* pSource = data)
{
float* p = pSource;
pointerWatch.Start();
for(int i = 0; i < Size; i++)
{
p[i] = 1.0f;
}
pointerWatch.Stop();
}
I'm posting this on the off chance that something in my preferences in Visual C# Express could be embedding html tags.
|
|
|
|
|
Hi Leslie,
there is not really a difference
for both of them, and using IE6 (or IE7):
1. when selecting some code, copy, paste, line breaks are gone
2. when selecting some code, copy, apply my tool, paste, line breaks are OK
but indents are gone
3. when selecting some code up to the closing PRE tag, copy, apply my tool,
paste, everything is fine
As such it is worse than most posts, since they do 2 and 3 fine.
All other browsers we have tested (Netscape, FireFox, Safari, Maxthon) show
no problem whatsoever in this regard.
I am still puzzled what the essential difference is between a small minority
of posts (including yours) and all the others. So I was hoping these few all did
the same unknown something while publishing. So far I dont know. Seems not.
Since each CodeProject page is a lot of HTML, it is really hard to tackle.
You will be able to read more on this next week, when the article will be published.
Regards.
|
|
|
|
|
Hi all
My combobox is html control I fill it from html control but I like to Conective his Items With my code from javascript What I can do
if you hava asmples give me it please
thanks evry body help me
Thaer
|
|
|
|
|
If your control has an id, you can use document.getElementFromId to get the control in javascript. What do you want to do with it ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi guys
any advise migrating C to C#? is there anything i should aware of?
thanks
|
|
|
|
|
Assuming you really mean C as opposed to C++, here is some basic info:
You will notice C# is object-oriented. Get used to it !
Try to grasp the benefits of "properties", they are great.
Dont try to solve all problems with "global variables" and lots of public members. Instead use classes, hide what does not have to be disclosed,
make all members either private or protected, and use protected or public
properties when your first reaction would be to use public members.
Normally you dont use pointers (they exist, but are used for solving
performance issues only, as in image processing; not for general usage,
such as say linked lists).
Arrays are objects too.
Dont worry about releasing objects; "new" does what "malloc" did for you,
"free" is to some extent automatic.
If you create an instance from a class that offers a public Dispose() method,
then you better end the object's life as soon as you are done with it,
by calling said Dispose() method.
that should get you started.
|
|
|
|
|
It's basically a full rewrite, and the idioms that drive a C program won't work, because C is not OO and C# is fully OO ( no non-OO code allowed ). As Guffa said, make sure you understand OO first, or your code will be a disaster.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Hi All,
I have on my Dialog 3 buttons - each of them call same method "GeneralButton_Click(...)"
I need to know witch button was click in the method - but i can`t do it by checking the text on the button.
How can i do it in different way ?
|
|
|
|
|
You can check the tag of the button, or just the button itself, work out which button it was directly.
You have three buttons with the same text ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The text are not the same -
But the text can change - so i cant know witch button according the text.
Can i attach to the button some integer or something like that ? if yes so how can i do it ?
|
|
|
|
|
Like I said, the Tag property
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You have references to all three buttons, and you have a reference to the clicked button in the sender argument sent to the event. Just compare the references.
---
single minded; short sighted; long gone;
|
|
|
|
|
Like Guffa said. You can also evaluate the ID of sender to determine the identifier associated with the button.
|
|
|
|
|
Here is some code to summarise what others have said.
<code>
private void generalbutton_click(object sender, EventArgs e)
{
Button button = (Button)sender;
MessageBox.Show(button.Name.ToString());
}
</code>
|
|
|
|
|
private void GeneralButton_Click(object sender, Eventargs e)
{
Button btn = sender as Button;
// Do whatever here.
}
Mark.
|
|
|
|
|
Hi,
the fundamental piece of information is: object sender is whatever object
has caused the handler to be invoked, in your case the sender will be a
button, so do:
Button button=sender as Button;
and now you are holding a reference to the button that got clicked;
you can use its position, text, color, ...
three properties are intended specially for identication:
- the Name, that's a string
- the Tag; you can assign whatever you like to a Tag; it takes any object,
and does not use them, its like a post-it to yourself
- the DialogResult; you can assign one of the DialogResult enum values to it.
|
|
|
|
|
|
I have a tabpage and a panel inside this tabpage. When I insert anything to panel I want to center tabpage's scrollbar because I insert anything center of this tabpage but TabPage Scrollbar place on left.Can you explain that how I code that???
another how can I reach height of scrollbar(tabpage's autoscroll)????
-- modified at 5:28 Saturday 28th July, 2007
|
|
|
|
|
If any one has practical ideas for IT engineering graduation project please send me it and I will be very thankful for him
my e-mail is michaelqog_71@hotmail.com
|
|
|
|
|
Practical, depends on your skills... You might try searching the forums for other people asking the same question, and then re-consider this post.
Hogan
|
|
|
|
|
Quit asking the same old question all the time. Use your brains
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I have a database and I figured out how to store data but i can't edit anything.
This is a part of my code:
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
MyDataSet.MyTable.AddMyTableRow(textBox1.Text,textBox2.Text,textBox3.Text,textBox4.Text,textBox5.Text);<br />
MyTableAdapter.Update(MyDataSet.MyTable);<br />
toolStripProgressBar1.PerformStep();<br />
MessageBox.Show("Update Complete", "Update Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);<br />
} <br />
<br />
private void button5_Click(object sender, EventArgs e)<br />
{<br />
DataTable dtedit = MyDataSet.MyTable;<br />
DataRow dr11 = dtedit.NewRow();<br />
dr11["Field1"] = textBox6.Text;<br />
dr11["Field2"] = textBox7.Text;<br />
dr11["Field3"] = textBox8.Text;<br />
dr11["Field4"] = textBox10.Text;<br />
dr11["Field5"] = textBox11.Text; <br />
dr11.AcceptChanges();<br />
MyTableAdapter.Update(MyDataSet.MyTable);<br />
}<br />
|
|
|
|
|
Hi,
I'm trying to receive windows messages to notify my program of when it has been deactivated or activated. I've used the following class, and a basic windows form to try it out:
public class AppMessageFilter : IMessageFilter
{
private const int WM_ACTIVATEAPP = 0x001C;
public bool PreFilterMessage(ref Message m)
{
if (m.Msg == WM_ACTIVATEAPP)
{
//Lost focus:
if ((int)m.WParam == 0)
{
MessageBox.Show("Deactivated");
}
//Gained focus:
else
{
MessageBox.Show("Activated");
}
}
return false;
}
}
And....
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Application.AddMessageFilter(new AppMessageFilter());
}
}
However, this does not work. I've tried different windows messages (e.g. WM_ACTIVATEAPP and WM_ACTIVATE), but neither get filtered in the PreFilterMessage method when I switch from my form to another application (e.g. internet explorer or another window). I'm only using the MessageBox parts to test it works - i've also tried omitting these and testing to see if breakpoints are reached.
I've tried this on both Windows 2000 and Vista 64. Any ideas where i'm going wrong?
Thanks
James
|
|
|
|
|
I don't know what's wrong here, but I copied your code and I don't get any of these messages, too.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|