|
I'm confused why so many people seem to ask this sort of question. IF you want something to happen on the client, you need to use javascript. If it's possible to do using C#, it will involve an entire page postback, by definition. You can't write C# code for the client, only the server.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Dear Christian Graus
Many thanks for your reply, I've only been writing .net pages for 4 months, it's been a hard slog, I understand what you have said and shall look at a Javascript script to carry out the task
Thanks
Rob
|
|
|
|
|
hi friends
i want to know how to put character by character on a textbox.
i am reading characters on my com port and i need to display character by character
i able put a string but not a character tell me
how to get it
bye
|
|
|
|
|
You can add a char to a string. If you can't, that is stupid, but calling ToString on the char would then fix it.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
How can i block receiving data except from one specific IP address??
thank you
rzvme
|
|
|
|
|
|
Say I have a few buttons on an MDIparent form.
By pressing one of the buttons I activated an MDIchild from.
At this point I would like to know what kind of buttons or controls
the MDIparent form has.
Any help would be much appreciated.
|
|
|
|
|
You shouldn't ever be able to tell, as they hsould not be public. But, if they are, then it's easy to find out. Just grab the Parent property, and cast it to the specific type of the form class.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I have a Asp.net 2.0 asp:FileUpload control on my page.
I want to keep the file name(file path) in the asp:FileUpload(textbox) after uploading the file.
I din't find any set property for asp:FileUpload
Any idea how to do this.
Regards,
Reji
|
|
|
|
|
I'm not sure and I'm not test it but EnableViewState = true may help
because it maintains control state
I Wish the Life Had CTRL-Z
|
|
|
|
|
I tried
EnableViewState = true
not working
|
|
|
|
|
I ask about this they told it's not possible
I Wish the Life Had CTRL-Z
|
|
|
|
|
|
Hi,
Does anyone know if it's possible to change the OS color Depth/Quality via a C# program?
Thanks,
Joe
|
|
|
|
|
I know of no way to do it in managed code.
I once did resolution changes with C# code by calling good old Win32 functions
(such as EnumDisplaySettings and ChangeDisplaySettings from user32.dll).
This requires the use of PInvoke and is not that simple...
Also it is considered bad practice for one application to change system settings
that affect all current and future applications.
Are you sure you want this ?
In the special case where one application is monopolizing the screen (e.g.
a full screen game), there are ways to do it using DirectX (for which a managed SDK
exists); I never did this tho.
Luc Pattyn
|
|
|
|
|
how to do this in C# ???
i get an error when i put the ref int m_param in the C# struct
What i'm doing wrong here
The ideia is the class be intatiated do some work , ant then put
the result int the refrence saved in the m_retParam.
--------------
C++
----
class A<br />
{<br />
int m_retParam&<br />
A(int ¶m) : m_retParam(retParam){<br />
}<br />
public void DoSomething(){<br />
m_retParam = 5;
}<br />
}
--------------
C#
----
class A<br />
{<br />
ref int m_retParam; :doh: <----------- Compilter error<br />
<br />
A(ref int param) {<br />
m_retParam=param;<br />
}<br />
public void DoSomething(){<br />
m_retParam = 5;
}<br />
}
|
|
|
|
|
I would expect the ref keyword only in argument lists, where it is typically used to
pass a reference rather than a value for value types, so the method called can
modify them (a variant of this is "out"). But no "ref" in a struct or class.
Luc Pattyn
|
|
|
|
|
Thanks for yor response .
How can i solve this in C#
can you give me a sugestion?
|
|
|
|
|
So you cant write
class A {
ref int m_retParam;
A(ref int param) {
m_retParam=param;
}
public void DoSomething(){
m_retParam = 5;
}
}
but you can write
class A {
public A() {}
public void DoSomething(ref int m_retParam) {
m_retParam = 5;
}
}
or
class A {
public int result;
public A() {}
public void DoSomething() {
result = 5;
}
}
the result now is available as A.result
or
class A {
private int result;
public int Result {get {return result;}}
public A() {}
public void DoSomething() {
result = 5;
}
}
the result now is available as A.Result
or, more in the way you would like it I guess, but with an extra class:
class B {
public int result;
public B() {}
}
class A {
private B m_retObject;
public A(B retObject) {
m_retObject=retObject;
}
public void DoSomething() {
m_retObject.result = 5;
}
}
the result now is available as B.result
(providing a B.Result property probably doesnt make much sense, since
it needs a getter for the caller, and a setter for class A, so it could as
well be public in the first place.
One of the above should suit almost every requirement.
Cheers.
Luc Pattyn
|
|
|
|
|
Thanks for your complete response
I think i will use the last example.
I Wonder why old simple things get so complicated in C# ...
|
|
|
|
|
It's all about safety.
Pointers are considered unsafe:
- if you can modify them (e.g. increment to scan an array), you may get outside
the valid range
- even if you cant, you might point to something that isnt alive anymore
(unless the CLR understands it really is a reference to an object, i.e. something
the CLR knows it is alive, and that is exactly what my class B is all about).
So C# offers you the following way to return results:
- through the return value of a method
- through an out or ref method parameter
- through an event (think of it as a callback function with input arguments)
each of these can be primitive values or aggregates (classes or structs).
Similar things hold true for delegates, which are basically function pointers
associated with a specific object.
Cheers,
Luc Pattyn
|
|
|
|
|
That code isn't possible in C#, you can't use a local field as a reference to an exisiting int, and then change it in some other method.
The ref parameter does allow you to modify the original calling instance, but not the way you want it.
|
|
|
|
|
Thanks for yor response .
How can i solve this in C#
can you give me a sugestion?
|
|
|
|
|
I have a form which contains a tab control, which contains two tab pages.
On each tab page, there is a DataGridView, bound to it's own DataTable.
In the RowsAdded event handler for both DGVs, when the first row is added, I resize the columns to fit the data. My handler looks something like this:
private void dgvAllEvents_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)<br />
{<br />
...<br />
dgvAllEvents.AutoResizeColumn(0, DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader);<br />
}<br />
<br />
This code works fine for the datagridview that is visible - that is, on the selected tab. However, the column does not get resized on whichever dgv is NOT visible - the tab page that is not selected.
The event is getting fired, I have confirmed that. But the column is not resized when the AutoResizeColumn method is called.
Is there an optimization here that prevents resize from being executed if the column is not visible?
Thanks for any insight you have here.
|
|
|
|
|
I have a bitmap file which I can load into a Bitmap object (or not if i don't have to), but I also have a number of smaller bitmap objects whose images should be sections of the larger image. The co-ordinates (top left, bottom right) of the sections I would like to take are known. I can do this by looping through every pixel needed, using the getPixel method on the larger bitmap, then the setPixel method on the smaller bitmap, however this seems a little bodged, and is probably a bit slow. Is there a better way to do this?
Thanks for any help.
|
|
|
|