|
thanks for your help.
I test your approach , for some control it work properly
but when use it for a component it return null.
?
|
|
|
|
|
I got a problem when using property grid:
I defined a class named ExampleClass with some properties.Then I did as follows:
ExampleClass myObject = new ExampleClass(...);
PropertyGrid myPropertyGrid = new PropertyGrid();
myPropertyGrid.PropertySort = PropertySort.Categorized;
myPropertyGrid.SelectedObject = myObject;
I would like the properties of myObject to be displayed in the property grid in the special order as I expected.Howerver,it didn't work.What should I do to achieve my purpose?
SOS,thank you!
|
|
|
|
|
|
Of course.
for each property of ExampleClass,Category attribute is attached.Problem does not lie here.I just want to properties of ExampleClass's object to be shown in property grid in some special order.Take properties A,B,C for example,A,B,C might be written in the code of class ExampleClass as follows:
public class ExampleClass{
...
public TypeB B { get {...} set {...} }
public TypeA A { get {...} set {...} }
public TypeC C { get {...} set {...} }
...
}
(ps:all required attributes have been already attached to A,B,C)
the special order I want to see is B first ,then A and C last in the property grid.of course,I set myPropertyGrid.PropertySort = PropertySort.Categorized.Now,you see,where the problem actually lies?
|
|
|
|
|
I have a C++ WinSock based client-server system which has the following design:
Client:
a. For each request, client connects to the server
b. Sends the input data
c. Waits for response (During this server does the processing and sends output)
d. Presents the results to the client
e. Socket connection is broken
Server:
a. Server waits in listen() loop
b. For each request, it spawns a thread
c. De-serializes input data
d. Does business logic and database operations
e. Transfers output to the client
Basically it is a synchronous multi-threaded socket based client-server solution with a simple design and adequate scalability. We have used it for years for upto 10 concurrent users and constant request-response cycles. Note that the request and response may consist of fairly large (e.g. 10 to 100 MB) files also.
Now we are re-designing the software with C#... I would like to know the optimal way to design the system, so that it is highly scalable. Please give your suggestions.
Thanks a lot !
|
|
|
|
|
The only suggestion I have is to use a ThreadPool on the server instead of spawning a thread directly. Threads tend to have high overhead for launching.
--
Joel Lucsy
|
|
|
|
|
I recommend going with either Web Services or .NET Remoting over HTTP hosted by IIS (which is exposed as a Web Service, so it's still one-way request/response). Scalability is handled by IIS leaving you with the higher-level functionality.
I also recommend implementing the WSE (http://msdn.microsoft.com/webservices/building/wse[^]) and using DIME to transfer files. It's a very simple API and does not require that the documents are serialized to a byte[] array like when you transfer it over the wire using Web Services or .NET Remoting. It's a binary wire format, and an industry standard to boot.
I recommend this because writing a socket client/server system and doing the serialization yourself is fine, but there's functionality for that already in the .NET BCL through Web Services and .NET Remoting.
Besides, Web Services are also an industry standard and open up new client possiblities that may otherwise be more difficult with a standard socket server (have to take endianess and packing into account).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Like Heath said, use a web service but we found that DIME
wasn't very good at handling large documents since it could
not stream. possibly u can use a webservice which returns
a http url of the file to be transfered. The client
receives the url and uses http protocol to download the
file. U can google for software which will help u to
download using http protocol
ex: sharpdownload project--sourceforge.net )
cool man
|
|
|
|
|
You can chunk large files using DIME - it's part of the specs.
Why does he need extra software to download files via HTTP? The .NET Framework BCL already has this. Use WebClient.DownloadFile for the simple way, or use HttpWebRequest and HttpWebResponse for a little more control and feedback. There's no need for an extra library. It's simply a waste.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
We found that WebClient.DownloadFile or HttpWebRequest and HttpWebResponse
has problems when the user is using proxy. we tried
using proxy class to supply relevent
information that also did not work.
Further the download seemed faster with
the extra library since it downloaded
parts of the file (using threads) and joined them later.
we dint have any problems with the proxy also.
Does the BCL classes also implement the
same?
cool man
|
|
|
|
|
I don't remember off the top of my head, but I believe that was fixed in .NET 1.0 SP2. I know it's not in the list of fixes for .NET 1.0 SP3 & .NET 1.1 SP1 (I got on this team at the time of their release).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
How to trim unnecessary white space whith in two strings using regular expressions?
|
|
|
|
|
Try the following:
string sentence = "Hello my name is Nick.";
string text = Regex.Replace(sentence, "\\s+", "");
Console.WriteLine(text);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi friends,
I am trying to copy stream of chars from file to buffer(char[]) by following code :
char[] cbufferi = new char[2000];
FileStream f=new FileStream
("test.dbf",FileMode.Open,FileAccess.Read);
BinaryReader br = new BinaryReader(f);
cbufferi = br.ReadChars(2000);
BUT method br.ReadChars(2000) reads only ASCII chars and it neglects NON-ASCII (char with value>127) and hence data stored in cbufferi is inaccurate. I am trying to read header of DBF files and then I want to further process header afterwards. Please let me know how can I read header of file so that it contains ACCURATE data ie. ASCII/NON-ASCII data.
Thanks for your help..
|
|
|
|
|
Did you try this:
<br />
byte[] buffer = new byte[2000];<br />
f.Read(buffer, 0, 2000);<br />
char cbuffer = Encoding.Default.GetChars(buffer);<br />
|
|
|
|
|
Hi John,
Hey Great... this worked. Thank you very very much for the help.
|
|
|
|
|
hi,
How can i cast datasource of a datagrid to a datatable.
I tried this block for that. But no result
DataTable dt=((DataTable)this.MicroGrid.DataSource) as DataTable;
Do u have any idea ?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Actually, the code should be:
DataTable dt = (DataTable)MicroGrid.DataSource;
You might want to check the type of the DataSource before you attempt to cast it to a DataTable. Not all DataSource s can be cast to a DataTable ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
Did you checked whether your answer is good enough to serve my purpose ?
Dear it is not working and i am getting a an error " specified cast is not valid ".
code block :
MicroGrid.Datasource=dataset.Table["xyz"].DefaultView;
DataTable dt = (DataTable)MicroGrid.DataSource;
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
sreejith ss nair wrote:
Did you checked whether your answer is good enough to serve my purpose ?
$#@*^@$$... Like I told you in my previous post. CHECK THE TYPE of DataSource before you try and cast it to a DataTable. Your DataSource is bound to a DataVIEW, not a table. You can't cast a DataView to a DataTable, so therefore, yes, "The specified cast is not valid."
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
My old post is a sample senario that i shown to you.
DataTable dt = (DataTable)MicroGrid.DataSource;
this also not working.
In my application, using a data adapter i am filling "Employee Table Data" into a dataset and store it in "EMP" table.
Adapter.fill(Dset,"EMP");
After this, i set the datasource of my grid(MicroGrid) to Dset.Tables["EMP"];
MicroGrid.Datasource=Dset.Tables["EMP"];
Then i tried this below mentioned lines of code
DataTable Dt=(DataTable)MicroGrid.Datasource
Still i am getting same error ?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Hi everybody,
How do I programmatically minimise and hide the console window in C# .NET ?
It is a console application.
Any help will be greatly appreciated.
Thanx in advance
saleem
|
|
|
|
|
One possible way would be through the use of the Win32 function FindWindow which will give you the HWND or Handle to the command window. Once you have the HWND you can call ShowWindow passing SW_MINIMIZE as the nCmdShow parameter. That should get you started.
[DllImport("user32.dll")]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
const UInt32 SW_HIDE = 0 ;
const UInt32 SW_SHOWNORMAL = 1 ;
const UInt32 SW_NORMAL = 1 ;
const UInt32 SW_SHOWMINIMIZED = 2 ;
const UInt32 SW_SHOWMAXIMIZED = 3 ;
const UInt32 SW_MAXIMIZE = 3 ;
const UInt32 SW_SHOWNOACTIVATE = 4 ;
const UInt32 SW_SHOW = 5 ;
const UInt32 SW_MINIMIZE = 6 ;
const UInt32 SW_SHOWMINNOACTIVE = 7 ;
const UInt32 SW_SHOWNA = 8 ;
const UInt32 SW_RESTORE = 9 ;
const UInt32 SW_SHOWDEFAULT = 10 ;
const UInt32 SW_FORCEMINIMIZE = 11 ;
const UInt32 SW_MAX = 11 ;
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi.
I want to access to all object on the form like sqlDataAdapters,DataSets and ... .
(Form.Controls not contain the sqlDataAccess like objects)
|
|
|
|
|
The Non-Controls are instance variables. You can get all variables with System.Reflection:
<br />
FieldInfo[] arrInfo = form.GetType().GetFields();<br />
foreach(FieldInfo info in arrInfo){<br />
Console.WriteLine(info.Name + " - " + info.GetValue(form));<br />
}<br />
|
|
|
|