|
Hello everyone,
I need to build up using C# HTTP Server (HTTP Listener, which could parse various HTTP fields, like post data and return response) and I also need to get an HTTP client which could package various HTTP fields (like URL, post data, etc.).
Are there any sample codes to recommend? I searched MSDN, failed to find any complete client and server samples. I have searched some other samples, which is built on TCP listener, and manually package/unpackage from TCP other than HTTP package level.
thanks in advance,
George
|
|
|
|
|
Hi All,
Is there a way to suppress/hide a section programmatically???
Thanx.
|
|
|
|
|
I've got some GUI win forms project1 with some class developed say SomeClass. That class has serialization ability to save its object to file and load it later.
SomeClass.Serialize()
{
...
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, this);
...
}
SomeClass SomeClass.Deserialize()
{
using (Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
{
IFormatter formatter = new BinaryFormatter();
return (SomeClass)formatter.Deserialize(stream);
}
}
Now the GUI has assemblyinfo.cs with its assembly AssName1 . I run the GUI and serialize the class to file. In that file that AssName is present at the beggining of the file.
Now I have another project2 with different name and assembly name AssName2. I added that SomeClass.cs code to that project and try to deserialize the object from that project.
It says:
can not find assembly "AssName1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
If I serialize that class from project2 it puts AssName2 to the serialized file. So it seems you can not share the serialized versions of SomeClass between differently named projects?
How can I deserialize the SomeClass object in project2 which was saved in project1?
chesnokov
|
|
|
|
|
The problem you have is that you've duplicated the code for SomeClass in both assemblies. This will make them different classes. (A classes full name includes it's assembly name).
What you need to do is only define SomeClass in one place, and reference it from everywhere that needs it. I would suggest you create a 3rd project (of type class library), call is SharedLibrary and place SomeClass.cs in that project. Then reference SharedAssembly from both Project1 and Project2.
(You can add references by right clicking on the project in the solution explorer and clicking "add reference", then using the browse tab to brose to the file.)
You can also create 2 solutions. The first containing Project1 and the SharedLibrary and the second containing project2 and the SharedLibrary. Now when you click "add reference" the SharedLibrary will appear under the projects tab.
Simon
|
|
|
|
|
|
I want read digital input status from Advantech PCI card,
but I have error like this:
"System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
//My Device configuration******************
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ\Device000]
"DeviceName"="PCI-1730 SwitchID=0 I/O=5000H"
"DriverName"="ADS1730.dll"
"KernelKey"="ADS1730S"
"BoardID"=dword:00000087
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ\Device000]
"DeviceName"="PCI-1730 SwitchID=0 I/O=5000H"
"DriverName"="ADS1730.dll"
"KernelKey"="ADS1730S"
"BoardID"=dword:00000087
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADS1730S]
"Type"=dword:00000001
"Start"=dword:00000002
"Group"="Extended Base"
"ErrorControl"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADS1730S\Device000]
"DeviceName"="PCI-1730 SwitchID=0 I/O=5000H"
"DriverName"="ADS1730.dll"
"KernelKey"="ADS1730S"
"BaseAddress"=dword:00005000
"BoardID"=dword:00000087
"SwitchID"=dword:00000000
"AllowConflicts"=dword:00000001
"Interrupt"=dword:00000000
"TimerClock"=dword:0000000a
"OnSystem"=dword:00000001
"BusNumber"=dword:00000000
"SlotNumber"=dword:00000000
"CardNo"=dword:00000000
"Trigger Mode"=dword:01010101
000:
My Code:********************************************************,
//Import dll********************
[DllImport( "adsapi32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi )]
private static extern int DRV_DeviceOpen( int DeviceNum, ref int DeviceHandle );
[DllImport( "adsapi32.DLL", SetLastError = true, CallingConvention = CallingConvention.Winapi )]
private static extern int DRV_DioReadBit( int DriverHandle, ref PT_DioReadBit lpDioReadBit );
[StructLayout( LayoutKind.Sequential )]
public struct PT_DioReadBit
{
public UInt16 port; //USHORT port;
public UInt16 bit; //USHORT bit;
public IntPtr state; //USHORT far *state;
}//PT_DioReadBit, FAR * LPT_DioReadBit;
**********USING********:
int errCde;
int driverHandle = 0;
int deviceNum = 0;
errCde = DRV_DeviceOpen( deviceNum, ref driverHandle );
PT_DioReadBit readBit = new PT_DioReadBit();
readBit.port = 0;
readBit.bit = 0;
errCde = DRV_DioReadBit( driverHandle, ref readBit );
int value = readBit.state.ToInt32();
modified on Wednesday, April 2, 2008 10:06 AM
|
|
|
|
|
arturw82 wrote: int driverHandle = 0;
int deviceNum = 1;
errCde = DRV_DeviceOpen( deviceNum, ref driverHandle );
Considering you're using an arbitrary handle and not a handle that's returned from the driver, it's no surprise that you're getting this message. Is it documneted anywhere that the driver handle will always be 0?? I doubt it... The same is true for the device number.
Your single best source of information on this is going to be the manufacturer of the board and the library you have to use to talk to it. Since your applciation is so very specific to a single piece of rarely-seen hardware, it's very unlikely your post is ever going to be seen by anyone with first-hand knowledge on using it.
|
|
|
|
|
Sorry, this error i have when deviceNum = 0;
When deviceNum = 1 i have error code "30" from function DRV_DioReadBit "Invalid driver handle"
|
|
|
|
|
Ok, great. This still doesn't change the fact that you're asking the wrong group of people for help with a very specific piece of hardware.
|
|
|
|
|
Hello all,
I have got 2 problems while working with crystal reporting in C#. I am a beginner with C# and crystal report
1. In my software every user has to be signed in with an ID and password. Now how can I show one particular user's report in crystal report. As a beginner I have used the wizard. But using the wizard I can show the full data table but not the data of a particular user with photograph.
2. I am using dotnetcharting class library for charting in my software. How can I include this tool in crystal report? In the report more than one charts will show the data of a particular user (who is signed in).
Please help me to solve this out
Thanks in advance
Faysal,
MSc Candidate, U-Health Lab,
Department of Biomedical Engineering,
Kyung Hee University, South Korea.
email: faysal_002299@yahoo.com
|
|
|
|
|
as far as the execution speed is concerned , should we use the crystal reports ?
I think , the exporting concepts should be implemented , over the crystal reports.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
hello,
How can i display my word document that contain text and images into my richtextbox?
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
Save the word document as RTF and open it up in the RTB.
|
|
|
|
|
but can this save method made automaticaly in the c# application or into a buffer without putting data into ma disk
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
There are several controls on codeproject that allow to display word files. Use search to find them.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Hi,
Please can anyone got answer of the following issue:
I have developed a Web Part in SharePoint using C#.Net. A TreeView control I have created which is pointing to some directories. Created an event of the TreeView (SelectedNodeChanged) Which is not firing all the time. Sometime it fires and sometime its not. I cant figure out the reason of such abnormal behavior. Find the attached code. Please help.
--------------------------------------------------------------------
CreateChildControl
{
Some More Codes here.....
TreeViewReportListTree.SelectedNodeChanged += new EventHandler(TreeViewReportListTree_SelectedNodeChanged);
Controls.Add(TreeViewReportListTree);
Some more codes here.....
}
----------------------------------------------------------------------
|
|
|
|
|
click Export.
Click Export to a file, and then click Next.
Click Comma Separated Values (Windows), and then click Next.
In the folder list, click the Contacts folder, and then click Next.
Browse to the folder where you want to save the contacts as a .csv file.
Type a name for the exported file, and then click OK.
Click Next.
Click Finish.
|
|
|
|
|
|
i am exporting the gridview data to excel in c#.Along with this , i am sending the heading also .so far , it is working very fine.
Problem is , the heading is comming in the first cell , I mean , i need to merge the first row .Can u help me ?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Hello
Does anybody no when serializing a class how to correctly add attributes the the parent element.
E.g.
<Root SchemaVersion="1.0">
<child>
</child>
</Root>
For the life of me I cannot get the SchemaVersion="1.0" to appear. Any help would be greatly appreciated.
Many thanks.
|
|
|
|
|
have you tried marking a property called "SchemaVersion" in your object with the XmlAttribute attribute?
|
|
|
|
|
I have a datagridview in my form. I have a Clear button and I would like the datagridview to clear its contents when I click the button. I have tried datagridview1.Rows.Clear() but nothing happend. I have also set the datagrids source to null but still nothing. Any help will be appreciated
|
|
|
|
|
Hi,
IMO there are two ways:
- when bound to a datasource, clear the datasource
- or clear the binding, then do Rows.Clear()
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: Hi,
IMO there are two ways:
- when bound to a datasource, clear the datasource
- or clear the binding, then do Rows.Clear()
Luc Pattyn [Forum Guidelines] [My Articles]
Thanks Luc! After clearing the datasource I then used the Rows.Clear(0) : and it works 100%
|
|
|
|
|
Hi, i have a math question. Can i find the roots of inequalities in C# - is there any algorithm. For example the equation is
x^4 + 3*x^2 + 8 > 0 or sin(2*x) + cos(3*x) < 1
...
How can i find with a program the roots of these inequalities?
I need to know this because i am writing a program which draws math graphs. It can draw inequalities (for example sin(2*x) < cos(x) ) and mark the intervals at which inequality has roots (where sine is smaller than cosine from the example). The hard part is that i can't find the points where the inequalities intersect - i can't find the bounds of the intervals where the solutions are.
Still learning...
|
|
|
|