|
int x = Int32.Parse(Console.ReadLine());
This one will also throw an exception if it isnt a number string
Yuvaraj N
|
|
|
|
|
int.Parse("1");<br />
float.Parse("1.1");<br />
double.Parse("1.123");
etc.
|
|
|
|
|
How do i get information about the Share folders in my computer
|
|
|
|
|
Does anyone know the correct way of marshalling inline multi-dimensional arrays?
I have the following structure that I want to reproduce in C#:
typedef struct tagMyStruct {
WORD Version;
char szName[3][256];
} MyStruct, *MyStruct;
Now if this was just an inline array:
typedef struct tagMyStruct {
WORD Version;
char szName[256];
} MyStruct, *MyStruct;
You do this:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] public struct MyStruct {
public int Version;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=257)]
public string szName;
}
But it is not, so it is not that easy. I have tried, without success:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] public struct MyStruct {
public int Version;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=257)]
public string name1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=257)]
public string name2;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=257)]
public string name3;
}
Any ideas?
David M. Kean
My Blog: Managed from Down Under
|
|
|
|
|
How can I use a c# com object in c++? I've tried an example but everytime I call this" Edcont::Edcont_InterfacePtr p(__uuidof(Edcont::EdconClass)); " in the c++ .cpp file, the app just closes. Does anyone have another example that I can use? This is the place where got the example that I used
http://www.csharphelp.com/archives/archive281.html[^]
|
|
|
|
|
Create your C# component as a System.EnterpriseServices.ServicedComponent, register it with regsvcs, and call it as you would call any other COM component from C++.
Best Regards.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
|
Hi
Type of enum member is underlying type for the containing enum, then why casting is necessary on enum member?
DF
|
|
|
|
|
Diana Fernandez wrote:
Type of enum member is underlying type for the containing enum, then why casting is necessary on enum member?
Because it isn't the underlying type (even though the value might be physically stored as such), it is the type defined in your enum.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
It so happens that I have a class named Poetic which is the rootelement. When SERIALIZED --using the XMLSerializer--the outcome should be:
<Poetic xmlns:xsi="http//www.w3.org/2001/XMLSchema-instance" xsi:noNameSpaceSchemaLocation="http://poetic.publisher.com/xmlcomm/poetic.xsd">
My Class declaration is:
[System.Xml.Serialization.XmlRootAttribute("Poetic")]
public class Poetic
{
// properties, methods and the like in here
}
When I serialize it comes out:
<Poetic xmlns:xsd="http://http://www.w3.org/2001/XMLSchema" xmlns:xsi="http//www.w3.org/2001/XMLSchema-instance">
So...
1. How do I get the xsi:noNamespaceSchemaLocation into the element using SERIALIZATION. I know the noName.. is part of the w3 spec.
2. How do I get rid of the xmlns:xsd="http://http://www.w3.org/2001/XMLSchema".
Thanks,
Guillermo Jimenez
|
|
|
|
|
Try the following:
[XmlRootAttribute("Poetic", Namespace="http://YourNameSpaceHere")]
class Poetic
{
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi,
I need to display Dynamic Report.For Ex,
Report Fromat is
S.no No of % Due to
Test1 TEST2 TEST3 TEST4 Total
Section1 10 1 5 6
Section2 15 3 6 9
Section3 20 5 7 12
In 'x' table ,
Group Section is there.Ex Group Section1,Group Section2,Group Section3.User will select the Group Section.
Ex they selected Group Section1.
Under Group Section1,we need to display Sections.For ex Section1,Section2 and Section3.
Depending on Section1 need to display Columns Test1,test2,test3 like that.
Now there is no value test2 and test5.So no need to display.
Depending on user Selection,It will be different.Now it's displaying all.Can u help me to do.
radsgr
|
|
|
|
|
Hello,
I have a DateTimePicker control with check boxes on a form (well, several, but the behavior is the same for all.)
In design time, I set the Checked property to false. And they appear without the check.
When I run the app, the control is drawn checked, altough looking in the debugger, the Checked property is false. Once I start clicking on the checkbox, it checks and unchecks correctly.
So, we have it with Checked==false and check drawn. If I click on the checkbox, the check is cleared, Checked is still false, and I get no ValueChanged event. If I click again, everything works as expected (Checked set to true , and ValueChanged event).
Is it a bug? or am I missing something?
Thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi all,
Is Window messaging by using the RegisterWindow MEssage API in C# a good way
to perform messaging between IPC ? How is it compared to IPC by MSMQ and .net remoting ? Is RegisteredWindow Message supported on Window 98 and Window ME also ?
Thanks
Patrick
|
|
|
|
|
pyhtang1 wrote:
Is RegisteredWindow Message supported on Window 98 and Window ME also ?
Check out the documentation for the function in the MSDN Library[^] for questions like these. In this case - if you understand what RegisterWindowMessage does - the answer should be obvious. You can't send unique messages without registering them.
What's best? Whatever is best for your situation. If you're communicating between two managed applications, I would not recommend Windows messaging. Use .NET Remoting with a TcpChannel . In .NET 2.0 they are also adding an IpcChannel which, IIRC, uses named pipes. Both are pretty fast, though there's a little extra overhead for using a TcpChannel . You could even create your own channel like the IpcChannel now - .NET Remoting is extensible enough.
If this was a named application, you could use Windows messaging, global memory, DDE, and anything else you can think of (you can use these in .NET, but often the overhead of P/Invoking what's required and marshaling isn't worth the trouble; .NET Remoting provides a rich RPC experience, too).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
How do I pass a form-controller instantiated in my form to a user-defined control?
|
|
|
|
|
What is a form controller? Maybe you should clarify your question a little bit.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi,
I would like to know in C# : how to detect that I have a break or connection with the network?
Best Regards
youssef
|
|
|
|
|
As we've discussed in this board before, you should P/Invoke any one of various native functions like InternetCheckConnection :
public bool Connected
{
get { return InternetCheckConnection("http://www.codeproject.com", 0, 0); }
}
[DllImport("wininet.dll", CharSet=CharSet.Auto, SetLastError=true)]
static extern bool InternetCheckConnection(string url, int flags, int reserved); You can also use this and similar functions defined in the WinInet library to force connections.
Look-up that function in the MSDN Library[^] and you'll find more options with other similar functions.
The pure .NET-way is just to request a network resource and handle SocketException or WebException (often times the SocketException is an inner-exception).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I would like to change the UK langage by FRENCH langage.
How can I do that ?
Best Regards
youssef
|
|
|
|
|
youssef wrote:
I would like to change the UK langage by FRENCH langage.
How can I do that ?
While there are articles here on Code Project, I would suggest you read Globalizing and Localizing Applications[^] within MSDN. This should get you started, if you have further questions, post again.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I have an usercontrol with some controls and a hosting windows-form application which includes that usercontrol.
I know how to handle the events in the usercontrol from the hosting application. I want to know if there is any way to handle events in the hosting application from the usercontrol?
Please let me know
|
|
|
|
|
Not unless the parent container hosting your control forwards you the events. Your user control should not know anything about the container that holds it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am trying to write a user control and I need to capture the arrow keys. The form I am testing on does not have KeyPreview on, but when my control has focus and I press the arrow keys it changes focus to the appropriate control on the form.
How can I capture the arrow keys?
After further investigation, if I press the key twice the control "sees" the keyboard press ???!!!!???
Thanks,
Richard
|
|
|
|