|
Hello,
I was wondering if there is a precise way of determining file download speed when using asynchronous read operations on Streams(BeginRead)? Particularry I'm downloading files using HttpWebRequest/HttpWebResponse.
Thanks
|
|
|
|
|
Is it possible to use a control such as textbox or something similar on a windows form and allow the user to change the font, size, etc...?
In addition I would like to retrieve the exact font and size, etc that was saved.
Thanks
|
|
|
|
|
Yes, the control should have a Font property. You can't change the properties on a Font though, you'd need to create a new font when a property such as size gets changed by the user.
fmardani wrote: In addition I would like to retrieve the exact font and size, etc that was saved.
From where ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am trying to figure out how to post a memory buffer which is composed of an XML document, to a ASP page and I am getting a specific error that I am not sure why its throwing. The error is "not all code paths return a value." Below is the code, Is there someone here that can point out my mistake?
Many thanks in advance.
--Derk
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
public class UTSPost
{
private const string BASE_URI = "http://Post/_Update.asp";
public string PostToWS(XmlDocument xmldoc)
{
string uriString = BASE_URI;
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
string postData = xmldoc.ToString();
// Apply ASCII Encoding to obtain the string as a byte array.
byte[] postArray = Encoding.ASCII.GetBytes(postData);
System.Windows.Forms.MessageBox.Show("Uploading data ...");
myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
myWebClient.UseDefaultCredentials = true;
//UploadData implicitly sets HTTP POST as the request method.
byte[] responseArray = myWebClient.UploadData(uriString, postArray);
// Decode and display the response.
//System.Windows.Forms.MessageBox.Show("Response received was :{0}", Encoding.ASCII.GetString(responseArray));
}
}
|
|
|
|
|
you need to return a string value in your method
|
|
|
|
|
Thanks.... Any idea how I can post the text of the xml ? If I tell it to post ToString I get the object name and not the text of the XmlDocument?
|
|
|
|
|
myXmlDocument.OuterXml
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm tryin to find online a sample of a Windows code on how to access an Access DataBase,how to retreive and dispaly Data from different tables, and also how to update that database, all my online search hits were samples on Sql server .
aPerfectTool
|
|
|
|
|
Hi,
Try using the following code.
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Samples\Test.mdb; Mode=Share Deny None;Persist Security Info=False;Jet OLEDB:System database=C:\SYSTEM.MDW;");
conn.Open();
OleDbDataAdapter da = new OleDbDataAdapter();
OleDbCommand command = new OleDbCommand();
command.Connection = conn;
command.CommandText = "select * from person" ;
da.SelectCommand = command;
DataSet ds = new DataSet();
da.Fill(ds);
Thanks and Regards
Pani
|
|
|
|
|
//insert the data into table using the access connection
//that is table having the two field
string name = t1.text;
int regno = t2.text
//stud is ur table name
//ur declare this variable as varchar in ur table then using '"++"'between //the varible
string query = "insert into stud values('"+name+"','"+regno+"');
OleDbConnection con = new OleDbConnection(@"Provider = Microsoft.Jet.OLEDB4.0;
Password = ; User id=Admin;Data Source =d:\table\stud.mdb");
con.Open();
OleDbCommand cmd=new OleDbCommand(query,con);
cmd.ExecuteNonQuery();
con.Close();
|
|
|
|
|
private void HomeFrom_Activated(object sender, System.EventArgs e)<br />
{<br />
<br />
<br />
PrimeInfoThread pTh = new PrimeInfoThread(this.pictureBox1,this.panel4,this.button1,this.button3,this.SLabel);<br />
Thread t = new Thread(new ThreadStart(pTh.ThreadProc));<br />
t.Start(); <br />
<br />
}<br />
<br />
...<br />
public class PrimeInfoThread<br />
{<br />
private System.Windows.Forms.PictureBox hPic ;<br />
private System.Windows.Forms.Panel hPan ;<br />
private System.Windows.Forms.Button but1 ;<br />
private System.Windows.Forms.Button but2 ;<br />
private System.Windows.Forms.Label slab ;<br />
<br />
public PrimeInfoThread(System.Windows.Forms.PictureBox hP,<br />
System.Windows.Forms.Panel hpanel,<br />
System.Windows.Forms.Button b1,<br />
System.Windows.Forms.Button b2,<br />
System.Windows.Forms.Label Sl) <br />
{<br />
hPic = hP;<br />
hPan = hpanel;<br />
but1 = b1;<br />
but2 = b2;<br />
slab = Sl;<br />
}<br />
<br />
public void ThreadProc() <br />
{<br />
EnumGetEDID InitEnumObj = new EnumGetEDID();<br />
InitEnumObj.AppInitEnum(slab); <br />
hPic.Hide();<br />
hPan.Hide();<br />
but1.Show();<br />
but2.Show();<br />
<br />
}<br />
<br />
}<br />
I have the above code where I modify my form controls in another thread.
Is is safe to do like this. How to do this using thread-safe calls/delegates.
Thanks.
|
|
|
|
|
Take a look at this[^] article on BeginInvoke
Hope this helps
Cheers,
Will H
|
|
|
|
|
Consider using class Monitor
|
|
|
|
|
How do I place the error icon on a custom form?
|
|
|
|
|
Not sure if this is what you're after, but you can get the standard error icon using the System.Drawing.SystemIcons.Error property. You could then draw this onto your custom form during its OnPaint method, or using a PictureBox (although this will probably render badly - removing the icons alpha channel - so your best bet is to draw it manually in OnPaint ).
Hope this helps
Cheers,
Will H
|
|
|
|
|
Thanks so much, Will. You're right - using .Image of the PictureBox looks rough. The OnPaint looks better.
|
|
|
|
|
Hi all,
i need to make 2 deployment packages with some limitations.
1. VS.Net Express :
I have only 1 EXE file (remind you its FW 2.0) but i want to make it
automaticly download the needed packages like Framework2 or windows
installer if from some reason it is needed.
basicly i can give only the EXE and thats it but if the user dont have the
framework its a problem , i can not send him menualy to the site.
i also dont need to install my program or unistall later, just install the
framework 2.0 and run my program(dont want icons too)
so what can i do here?
2. VS.Net Express too:
this one have EXE and WAVS + readme..etc.
and i want to make Installation to start menu (no desktop no quick launch)
and also uninstall..
if this package do not check and download the framework 2.0 , it will be ok
but if it is posible - that would be great.
P.S: the reason i use VS Express is because i have licnece for it, otherwise my problems would be over , i would have used the deployment projects.
Please help i have no idea what to do.
Thanks alot people,
Ran.
R.Z
|
|
|
|
|
Private Sub Socket_ConnectEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Socket.ConnectEvent<br />
Dim Index As Short = Socket.GetIndex(eventSender)<br />
Socket(Index).SendData(Data(ClientID(Index)))<br />
End Sub
The Code above i'm trying to convert into C# I'm having a pretty tough time at it,I have this in my Constructor::
socket.ConnectEvent += new EventHandler(Socket_ConnectEvent);
in the Body i did have short index = Socket.GetIndex(eventSender)
|
|
|
|
|
I want to be able to start an app the 1st time the user clicks a button, with the 2nd and subsequent calls simply giving focus to the already running instance. Since there's no Focus method, how would I go about doing this?
|
|
|
|
|
Hello,
I have implemented a webservice by using websphere. an c# client calls this service successfull, however it always gives a timeout in the second call. The first, third, fourth call etc.. are alway successfull but the second fails all the time (timeout). Monitoring the servlet on the websphere side shows that there is no incoming traffic from the second c# call.
I tried both ways (synchrone-call and the asynchronious variant) but the second call always causes a time-out.
the .jsp testpage (generated by the websphere environment) works fine all the time, so the suspecion points to c#
who has an idea what can cause the trouble.
thanks in advance
leon van rooijen
|
|
|
|
|
I've created an application that uses panels with images as background having a pretty good looking application at the place of the normal windows xp style...
But when i resize it, or i wait to see it ended to load on start, or in all the other time that it is called on paint event, i see flicker the panels that uses images as background.
Sometime i see it all black before fully end to draw the image or i see just the border.
Why? How can i avoid it? (i use double buffer too)
|
|
|
|
|
Ok, I have the following problem. A function is called asyncronously in the program, and someone told me that is done in a new Thread. Inside the function I want to open a new form but it crashes when I try. So i decided I have to open the form in the main thread. Can anyone please tell me how can I do just that? Thank you.
|
|
|
|
|
Use Form.Invoke to call a control method outside the thread where it was created. You have to know how to work with delegates to do that.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Thank you verry much
|
|
|
|
|