|
George_George wrote: I find there is no resource release method for WebClient class
It provides a Dispose() method which you can use to release the resources which it holds.
|
|
|
|
|
Thanks N a v a n e e t h,
Question answered.
regards,
George
|
|
|
|
|
I've convert my .doc document to .html. Maybe do you know if it is possible to read information from html source with C# (for example to read where formatting is changing, for example to bold, italic etc.
Thanks for your help
|
|
|
|
|
|
Hi !
i m using paint.net v3.22 free software in myproject , i added it in my solution so i have two project in
one solution now i want to call paintdotnet thorugh my project i got success , now i like to send image through code in paintdotnet ,
paintdotnet use workspace class i didnt understand yet how to send image through my project and edit them and then send back to myproject its my task
i m very thankfull to you plzzz any one help me .....thanks in advance .
some code are below that i tried plzzz help.
//its a button that is place in form1 its in myproject , and i m calling paint.net in mysoftware thorugh this code i get success but wanna send image that is in picturebox to paint.net but not getting any thing plz help me .
private void button2_Click(object sender, EventArgs e)
{
PaintDotNet.MainForm mF;
mF = new PaintDotNet.MainForm();
//PaintDotNet.PdnResources.GetImageResource(@"C:\Sunset.jpg");
//PaintDotNet.PdnResources.LoadImage(@"C:\Sunset.jpg");
// string[] fileNames ;
////string startingDir = Path.GetDirectoryName(documentWorkspace.FilePath);
// string startingDir = @"C:\Temp";
//public documentWorkspace;
//DialogResult result =PaintDotNet.DocumentWorkspace.ChooseFiles( PaintDotNet.DocumentWorkspace. , out fileNames, true, startingDir);
//PaintDotNet.DocumentWorkspace.ChooseFile(
//PaintDotNet.Actions.ImportFromFileAction(@"C:\Sunset.jpg");
// ImportFromFileAction(@"c:\sunset.jpg");
//PaintDotNet.Actions.OpenFileAction(pictureBox1.Image);
//PaintDotNet.Actions.NewImageAction();
// mF.AppWorkspace.PerformAction(new OpenFileAction());
// PaintDotNet.AppWorkspaceAction(new Image("C:\sunset.jpg"));
//PaintDotNet.AppWorkspaceAction(new OpenFileDialog());
mF.Show();
}
|
|
|
|
|
Hello everyone,
For ManualResetEvent and AutoResetEvent, I noticed some samples which does not call Close after using them.
1.
I think to be of good practices, we should call Close after using them -- the reason is both ManualResetEvent and AutoResetEvent wraps native resources and release immediately will make system have more capability to serve in the future?
2.
What native resources are wrapped?
thanks in advance,
George
|
|
|
|
|
1 - Call the Close() method when you finish using it. You can leave this to GC - AFAIK, wait handles, has very low OS burden. So cleaning it with GCs collection life cycle won't make any issues, I guess. When the application domain ends, all wait handles will be released.
2 - Use reflector to see what native resources it wraps.
|
|
|
|
|
Thanks N a v a n e e t h,
Looks like both of them are wrapping native mutex handle?
regards,
George
|
|
|
|
|
Hai,
Am doing Live chat project in c# using sockets. In that client server interaction(1 to 1) is ok. More than one client is connected (1 to n) to server then problem is if am sending message from server its going to all clients. But i want to send message to particular user. Please any one help me.... sample code for start Lisening in socket...
private void StartListen_Click(object sender, EventArgs e)
{
try
{
string portStr = textBox2.Text;
int port = System.Convert.ToInt32(portStr);
Create the listening socket...
m_mainSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
IPEndPoint ipLocal = new IPEndPoint(IPAddress.Any, port);
m_mainSocket.Bind(ipLocal);
m_mainSocket.Listen(4);
m_mainSocket.BeginAccept(new AsyncCallback(OnClientConnect), null);
UpdateControls(true);
}
catch (SocketException se)
{
MessageBox.Show(se.Message);
}
}
Thanking you,
Regards,
Nvrk
|
|
|
|
|
Hello everyone.
I am a relatively new and novice programmer, having only been programming for a few months.
I am trying to figure out what is going wrong with my simple TCP client / server program.
The server reads the bytes from a file, and sends them over a socket to a client, who reads the bytes into a buffer and outputs the bytes to the screen. After a while of doing this successfully, however the data read off the socket is nothing more than a bunch of zeros. After the correct amount of bytes has been read from the socket, it blocks as it expects more data and produces a timeout exception.
My code is as follows:
static void Main(string[] args)
{
if (args.Length > 0)
ServerMode();
else
ClientMode();
}
private static void ServerMode()
{
Socket listen = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint iep = new IPEndPoint(IPAddress.Any, 8888);
listen.Bind(iep);
listen.Listen(3);
Socket sock = listen.Accept();
byte[] data = File.ReadAllBytes("C:\\bmptemp.bmp");
NetworkStream ns = new NetworkStream(sock);
ns.Write(data, 0, data.Length);
while (true)
{
int i = 2 + 2;
}
}
private static void ClientMode()
{
int recv = 0;
int totalRecv = 0;
Socket connect = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
connect.Connect(IPAddress.Parse("192.168.1.13"), 8888);
NetworkStream ns = new NetworkStream(connect);
do
{
byte[] data = new byte[1024];
recv = ns.Read(data, 0, data.Length);
totalRecv += recv;
foreach (byte b in data)
Console.Write(b.ToString() + " ");
}
while (recv > 0);
Console.WriteLine("Bytes read: {0}", totalRecv.ToString());
Console.ReadKey();
}
If the arguments passed into the command line are greater than 0, ServerMode is started, whereas client mode is started.
I would just read all of the bytes in one lump sum by making an overly large buffer to place the data in, but I wish to do it in small chunks like above so that I can add a progress bar and estimated time of completion to the simple program.
Any ideas as to why this doesn't download off of the socket properly? Any help, thoughts, or comments are greatly appreciated!
|
|
|
|
|
Hi
In a standalone windows app, I create a table, add rows to it, populate a couple of rows and add the table to a dataset.
I bind the table in the dataset to a datagrid.
If I make changes to the grid, the contents of the table are updated and the rowstate is set to modfified.
In a client/server situation, I fill a dataset with a table from a database and pass the dataset to the client.
On the client side I bind the table in the dataset to a datagrid.
The datagrid displays the data.
But if I make changes to the datagrid, no changes are made to the dataset.
In both cases I use
gridUsers.SetDataBinding(dsUsers,"UserList")
Where does the difference come in?
Just say if you need code snippets.
Obviously, until I can get the dataset to reflect changes made to the datagrid, I am going nowhere with developing this app.
Thanks,
Nigel
|
|
|
|
|
i think u need to call AcceptChanges() method on dataset
rahul
|
|
|
|
|
The point is that there aren't any changes in the dataset. That is the whole problem, changes made to the grid contents do not change the dataset.
|
|
|
|
|
|
Thanks, but I can do that just fine. This example is all on one Windows form. The problem occurs when I fill a dataset from a database at the server, send the dataset to the client, and the client binds the dataset to a datagrid.
When I do this, the datagrid does not update the dataset.
If I create a windows form with a datagrid on it, and fill the dataset using code on the same form, then changes to the datagrid update the dataset.
It is as if the compiler knows that the dataset was passed over the network and refuses to implement the data-binding in both directions
Nigel
|
|
|
|
|
im doing a project about RFID system registration..
database-ms access
database name=registerDBDataSet
table=ASAS
column=GAMBAR
in my form i have a gambarPictureBox,which retrieve the image from my pc(use browse button) from openFileDialog..
when run the program the image is open in the pictureBox and i want to save the image to database..
which way can i use?
since many coding that i search from internet using sql command,is there any other way to retrieve image from picture box and insert it into database?
the error happen when this code run:
private void saveButton_Click(object sender, EventArgs e)
{
this.aSASTableAdapter.Insert(nameTextBox.Text, tptLhrTextBox.Text, trhLhrTextBox.Text, jantinaTextBox.Text, kaumTextBox.Text, agamaTextBox.Text, wargaTextBox.Text, statusTextBox.Text, ICTextBox.Text,gambarPictureBox.Image);
this.aSASTableAdapter.Fill(this.registerDBDataSet.ASAS);
}
---->Error 1:The best overloaded method match for 'Registration.registerDBDataSetTableAdapters.ASASTableAdapter.Insert(string, string, string, string, string, string, string, string, string, byte[])' has some invalid arguments
---->Error 2: Argument '10': cannot convert from 'System.Drawing.Image' to 'byte[]' C:\Documents and Settings\fathiah.FATHIA-582A635D\Desktop\Registration\registerForm.cs
how to solve it..
please help me..
|
|
|
|
|
you need to save the picture as bytes not as system.drawing.image object. the Dtabase don't know object there are just 0 and 1
But please don't ask me how to convert a image into a byte array...
|
|
|
|
|
as both errors indicate - the last parameter expects a byte array (byte[]) but your passing an Image object. Convert the image to a byte array first (maybe by saving to a memory stream? - google for best solution!) then pass that to the method instead.
System.IO.MemoryStream memStream = new System.IO.MemoryStream();
gambarPictureBox.Image.Save(memStream, gambarPictureBox.Image.RawFormat);
byte[] imageBytes = memStream.ToArray();
To load you'll have to do the reverse.
Dave
modified on Monday, June 2, 2008 6:37 AM
|
|
|
|
|
|
Hi there!
I finally got XP worked with win2k before. Iv'e installed VS2005 and though it could go on. i compiled my project (succeeded)[edit] c# framework 2.0.50727 [/edit]
press F5 and then........
"..Error while trying to run project....<br />
<br />
This application has failed to start because the application configuration is incorrect. Review manifest file for possible errors. Reinstalling the application may fix this problem. for more details, please ssee the application event log."
I think you know this message at all (I googled it, searched in several forums, tried the suggestions but no success at all)
Could someone give me a clue how to fix this error? i allready looked up in securty.config, manifest and spended 2 days to find a solution at all....
thanks in advance
Mathias
|
|
|
|
|
What does it say in the event log? It sounds like a missing dll - or one not in the expected location.
Dave
|
|
|
|
|
by event log you mean the manifest file don't you?
mathias
|
|
|
|
|
In the error that the OP posted it finished "please see the application event log" - so I figured that would be a good place to look!
Dave
|
|
|
|
|
You're saying that you've searched for the answer with no success for 2 days , but you didn't repair/reinstall, like the suggestion says?
I wouldn't have waited for more than 2-3 hours before I did a reinstall.
|
|
|
|
|
ähm are you sure you are a developer?? MY .exe should be reinstalled not VS2005.... so how will i reinstall a application that I'm developing in the moment??? if you could say me that i will become a rich man.
but thanks anyway found the error:
ClickOnce Securty Settings were enabled. I don't know why but I'm happy that i found this "bug"
thanks for your suggestions
|
|
|
|
|