|
To be more precise (based on what leppie said), all reference types (pretty much everything) are like pointers - they are references to a class object. Value types - the intrinsics like int (Int32), long (Ing64), etc., DateTime, enums, and other classes deriving from ValueType - are just that - values. When using these in parameters, ref types are automatically pass-by-ref and value types are automatically pass-by-value. If you need to pass a reference to a value type, you can use the ref or out keyword. Rarely do you / should you use these for reference types (typically only necessary when P/Invoking native methods that take a pointer to a pointer to a type).
You should probably read the C# language documentation in VS.NET / MSDN and get familiar with it before running into problems like these. Walk before you run.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi. I'm trying to open a new webform inside another active webform, sort of like a pop-up. THe idea of the smaller form is that the user can select a street for an address to go with the city that was selected on the main form. Once the street is selected, the pop-up closes and the data is moved to the main form. Now, I've been able to do all of this with datagrids on the main form (we use SQL SERVER here), but it is not very nice to the eye. Anyway, my question is thus: Is there a way to have C# open a new, smaller form, without haveing to resort to Javascript in the HTML of the main ASPX page.
Krisman
|
|
|
|
|
First, this is better suited for the ASP.NET forum.
Second, C# compiles to IL which is contained in assemblies which execute code ON THE SERVER. In laymen's terms, C# is only server-side when dealing with Web Forms. So, no, you can't open a popup window using C# without resorting to writing some Javascript/JScript or an HTML link with an appropriate onclick handler or target attribute value.
A quick search on CodeProject would reveal (and at the time this was written, it was right on the homepage under "Latest Best Picks") an ASP.NET WebControl that makes popups easy to deal with (at least for n00bs) at http://www.codeproject.com/aspnet/asppopup.asp[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you very much!
Krisman
|
|
|
|
|
Hello every one:
I have a question that confuse me always ,I think most C#
fans have the same one.The question is if we can do API-Hooks
with C# onely or with other help,if we can please give us some advice ,I think there are many programers know what to do.If you can give ,please help.
thank you very much.
Best wishs
sorry for my poor English
sdfasd
|
|
|
|
|
If you need to handle message in your application, implement IMessageFilter and add it to your application's queue filter using Application.AddMessageFilter .
Otherwise, please try searching CodeProject articles or the forums first. This has been covered far too many times and is pointless to keep posting. For one article on CP, try this: http://www.codeproject.com/csharp/NetWin32Hooks.asp?target=hooks[^]
To search the comments, click "Search Comments" directly above this threaded-forum view and try searching for "hooks".
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you Heath Stewart:
I know what is your means.In the example of MSDN,
it is a local hook,and it is also a local hook in all
hook-example that I saw.I think we really need to know
what should we do in a journal-hook.for example ,the
API-hook is so.
sdfasd
|
|
|
|
|
I'm afraid I don't follow you. Are you asking what journal hooks are good for, such as example usage of a journal hook?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Sorry for my late:
Heath Stewart I think you can help me .
I want to say if we can use journal-hook in C# onely.
If we can do it.Please give me a sample,thank you.
The second question is if we can use API-hook in C#.
Bestwishes
sdfasd
|
|
|
|
|
|
Thank you Heath Stewart:
I saw all of the source-code.But they are local-hooks
I really want to know journal-hooks .
thamk you.
sdfasd
|
|
|
|
|
here is the problem; i am looking for a solution.
On a button click; i want to open a rich text editor or WordPad; and want to copy the text typed there to my own text field, once user clicks exit/cut Button.
can i do this?
is there any control available to use worpad in our application? like msword.olb for MSWord programming.
i am using vb.net with asp.net; had to do this on a aspx web page.
Looking for Help
ASIM
Asim
|
|
|
|
|
Hi all!
I need to do sound compression in C#.
I record sound from microphone in wav format then I have to compress it (to Mp3, WMA of other format) to send over network and play on client computer. I found some things working with files but I can only work with streams.
I explored a lot of variants for several days but:
1. .Net Class Library doesn't include anything working with sound.
2. DirectSound doesn't do sound compression.
3. DirectShow is not included in Managed DirectX 9.0 so I can't use it from .Net
4. Windows Media Encoder doesn't work with streams
5. Audio Compression Manager maybe the only one tool to compress sound. Has anyone reference how to use it from .Net? (now I import functions from it's dll and try to use it)
Am I right in my conclusions?
Please help me!
Taras
|
|
|
|
|
No, the .NET BCL does not have anything to deal with sound. While it should've at least had some basic classes to play WAVs, sound compression is not really common in a base class library - it's often something found in extensions.
Such is the case with Managed DirectX. DirectSound doesn't need to do sound compression because it deals with filter chains. You chain a series of readers, decoders, mixers, encoders, and writers together. You can even play with this process visually using the GraphEdit application that is installed with the DirectX SDK.
And Windows Media Encoder does deal with streams, both reading from and outputing to. I've done is many times in the past.
On a more personal note, please do not email me directly with the same question that you post in the forum. I or somebody else will get to your question when we see it and feel comfortable answering it. Everyone's time is precious, and using this forum soley helps preserve the knowledge in a searchable archive (though no one ever seems to search first anymore) that is available to help everyone.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you very much!
You answer clears solution in general but can you write an exact links to classes, methods in DirectX or Windows Media Encoder SDK that deal with my problem because I still can't find them!
P.S. Is there any way to use DirectShow from C#?
Taras
|
|
|
|
|
Then you'll have to read the DirectX SDK - it's the only way to learn. You can also google for examples or look at the code in the samples that are installed with the SDK.
There are plenty of examples of using DirectShow in C# here on CodeProject - just search! Perhaps the 'DirectShow' keyword would return you several.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I'm trying to save a Button object to a file, with the following code:
[Serializable]
public class SaveSettings
{
public System.Windows.Forms.Button btn = new
System.Windows.Forms.Button();
}
System.Windows.Forms.Button testBtn = new System.Windows.Forms.Button();
SaveSettings.btn = testBtn;
Serializer.Serialize(settings.btn,"C:\\aButton.btn");
public static void Serialize(object Object, string FileName)
{
BinaryFormatter bformatter = new BinaryFormatter();
Stream stream = File.Open(FileName, FileMode.Create);
bformatter.Serialize(stream, Object);
stream.Close();
}
But I get the following exception:
An unhandled exception of
type 'System.Runtime.Serialization.SerializationException' occurred in
mscorlib.dll
Additional information: The type System.Windows.Forms.Button in Assembly
System.Windows.Forms, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable.
What is wrong? How can I make it serializable?
I'm also trying with a Panel(containg butttons) and a TreeView(containing nodes), it all results in the same exception.(Simpel things as an ArrayList,string, int or double works fine)
Thanks in advance for your help ,
Thomas
|
|
|
|
|
Do you really want to serialize the button?
You could instead save button's Checked state and/or the button's Text label.
-rick
|
|
|
|
|
Yes, because my applicaton creats buttons in realtime.
Actualy I'm trying to save a ArrayList of Panel objects(allso made in runtime) that contains diffrent sized buttons. I've created a button class that extends the windows button class, with addisional information. Same thing for the panel.
Sorry about my bad English.
|
|
|
|
|
The Windows.Forms-Controls are not serializable, but you can export all properties of the Button and serialize the Hashtable. After deserializing the Hashtable, you can set all properties "by name".
Hashtable hashtable = new Hashtable();
ListFields(button, hashtable);
//...
private void ListFields(object obj, Hashtable ht){
BindingFlags flags = BindingFlags.Instance | BindingFlags.Public;
FieldInfo[] arrInfo = obj.GetType().GetFields(flags);
foreach(FieldInfo info in arrInfo) {
ht.Add(info.Name, info.GetValue(obj));
object fieldValue = info.GetValue(obj);
if(fieldValue != null){ ListFields(fieldValue); }
}
}
|
|
|
|
|
In a similar fashion - though a little more "serialization-friendly", you could create a class that implements ISerializationSurrogate that serializes the Button and add that to the serialization formatter's SurrogateSelector . Then you don't have to worry about overriding serialization in the parent, properly serializing field values, and stuffing them in a Hashtable to be later serialized. Using ISerializationSurrogate is pretty much the same as implementing ISerializable .
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Actually i am developing a dialog like datalink dialog. The user has to select first what provider he wants. According to that provider i have to display next page of the tabcontrol how can i do that
Please explain in brief
Thanx in advance
Regards
INAM
Inam
|
|
|
|
|
tabCtl.SelectedIndex = listbox.SelectedIndex;
or
tabCtl.SelectedTab = tabpage;
|
|
|
|
|
How do I clear screen from a C# console application? Does it involve using P/invoke. THank cyril
|
|
|
|
|
Try this : http://support.microsoft.com/default.aspx?scid=kb;en-us;Q319257
|
|
|
|