|
Probably so. But if IE is handling things directly, then there's no real way that I know of to figure the sizes. As you pointed out earlier, IE might have the statistics -- if there's a way to get to them.
I don't know a general way to do what he wants. I'll be interested in seeing if someone else has a solution, though.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Since you're not actually building a brwoser control, but wrapping the one in the toolbox in your own UI, there's no real method to get the data you want. The browser doesn't expose this information and using alternate methods would only result in partial results at best.
If you want those stats, you're going to have to build and make the requests yourself and handle the returned page as well. That's about the only method you've got to knowing how much data was sent and received.
|
|
|
|
|
Thank you all for your help ....
your time is very much appreciated.
I know nothing , I know nothing ...
|
|
|
|
|
Guys i have a text file that i store my settings in so that they are availible in every forum .
basicly its in the following format
DownloadFolder = /mnt/md1/public/Downloads/
TelnetUser = root
TelnetPassword = something
TelnetIP = 192.168.2.2
So im looking for a way to take each of those settings and turn them into strings with values inside my c# program . Im useing the stream reader class below but im not sure what to do next after i split the strings into an array .
private void LoadSettings()<br />
{<br />
StreamReader Settings = new StreamReader("Settings.txt");<br />
string line;<br />
while ((line = Settings.ReadLine()) != null)<br />
{<br />
if (line.StartsWith("/"))<br />
{<br />
}<br />
else<br />
{<br />
string[] splitArray = line.Split(new char[] { '=' });<br />
<br />
<br />
}<br />
}
|
|
|
|
|
Member 6038196 wrote: but im not sure what to do next after i split the strings into an array .
How are we supposed to know? All you said you wanted to do was:
Member 6038196 wrote: im looking for a way to take each of those settings and turn them into strings with values inside my c# program .
Which you might already have with splitArray if your code is correct. From there, you can do whatever you want next but we have no idea what that is.
|
|
|
|
|
Hi,
if the non-comment lines are all "key=value" statements, AND assuming all keys are different, you could store them all in a Dictionary<string,string> making retrieval easy.
Note: Dictionaries don't preserve order, so if you were to modify and store the settings again, the file might look different (and your comments would be gone). If you want to keep comments and order, you could define your own little "MySettingItem" class to keep comment, key and value, and just build a List<MySettingItem> while reading the file.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Not sure if I understand correctly, but is it something as simple as:
string key = string.Empty;
string val = string.Empty;
if (splitArray.Count > 1)
{
key=splitArray[0];
val=splitArray[1];
}
at this point, you've got both elements of your configuration item that you can then do whatever you want with. HTH.
Josh
Find a penny, pick it up, and all day long you'll have a back-ache...
|
|
|
|
|
I prefer to use XML and then use a System.Xml.XmlDocument to read and write it.
|
|
|
|
|
I want the data stored in database to be displayed from the first record in the database. These data were submited to the database via textbox and I want to load the first record from database and display in the textbox.
below are the codes that I have check Beginners guide to accessing SQL Server through C# but can't still do it. No error but dont know what to do. Please I need help on this
Thanks
Ademola.
private void COMPANY_INFO_Load(object sender, EventArgs e)
{
SqlConnection myConnection = new SqlConnection("user id=sa;" +
"password=admin123;server=ADEMOLAPC;" +
"Trusted_Connection=yes;" +
"database=Kay_Nylon_Db; " +
"connection timeout=30");
myConnection.Open();
//try
//{
SqlDataReader myReader = null;
SqlCommand myCommand = new SqlCommand("select * from Company_Info", myConnection);
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Console.WriteLine(myReader["Company_Id"].ToString());
Console.WriteLine(myReader["Company_Name"].ToString());
Console.WriteLine(myReader["Company_Address_Line1"].ToString());
Console.WriteLine(myReader["Company_Address_Line2"].ToString());
Console.WriteLine(myReader["Fax"].ToString());
Console.WriteLine(myReader["Email"].ToString());
}
|
|
|
|
|
Your connection string is wrong to start with. If you supplied a username and password you do not use TrustedConnection.
The rest of the code looks reasonable, so long as the SQL statement is correct and there's data in the Company_Info table, and the column names are correct.
|
|
|
|
|
Thanks Dave,
I have removed the trusted connection but can not still retrieve from the database. All I want is onformLoad it should get the record from database and display it in textbox.
Expecting your reply
Ademola.
|
|
|
|
|
Don't "expect" anything from a site where you're not paying for support.
OK. Do you have this code inside a Try/Catch block?? Remove the code from inside the Try block. There's too many people not putting anything in the catch block, silently eating any errors.
If there are no errors, then the table is empty and there's nothing to return to you.
|
|
|
|
|
When I am working with a datareader, I always try and make sure that I actually received a datareader back from the ExecuteReader() call (ie "if(myReader != null)". I also check the HasRows property on the datareader object to verify that I have results to loop through. The way this is coded now, the while loop will read each record from the datareader. If data from the first row is all that is needed, calling myReader.Read() by itself will just read the first row (instead of using the while loop).
Josh
Find a penny, pick it up, and all day long you'll have a back-ache...
|
|
|
|
|
Ademola,
can you post the latest code your using. It is difficult to diagnose the problem without the code you are currently trying to run.
In the meantime, try to initialise your connection string using the connection string builder to rule out any typos in connection string.
SqlConnectionStringBuilder conn_str = new SqlConnectionStringBuilder();
conn_str.UserID = "your user_id";
conn_str.Password = "your password";
conn_str.InitialCatalog = "database name";
conn_str.DataSource = "sql server instance name";
conn_str.ConnectTimeout = "connection timeout (as an int)";
SqlConnection conn = new SqlConnection(conn_str.ConnectionString);
Also, make sure you rule out any accidently brain explosions, ie make sure datatable actually has data in it, your connecting to the right database, etc
Dave
|
|
|
|
|
can i fetch null field from database while showing it in textbox on page load event..???
|
|
|
|
|
hi,
How can i locate the form at the buttom rigth off the screen.
I can't do it manually, because the users have defferent screen size or definitions.
Thans for the help...
|
|
|
|
|
Do you mean the form in YOUR application, or ANY application?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
In my application.
Is there a difference if it's my application or any application?
|
|
|
|
|
Hi,
you can find out what screen you are using (when on a multi-monitor setup), get its resolution, then position the form appropriately. You would need the Screen class (maybe GetWorkingArea() method), and set the Form's StartPosition and Location properties.
BTW: you may have to take the selectable behavior of the task bar into account.
PS: for other apps, you would need to send Window messages and/or call Win32 API functions.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Screen currentScreen = Screen.FromRectangle(this.RectangleToScreen(ClientRectangle));
this.Location = new Point(currentScreen.Bounds.Right - this.Width, currentScreen.Bounds.Height - this.Height);
I know nothing , I know nothing ...
|
|
|
|
|
|
Hello,
I want to use the errorprovider control with checkboxes I have on a form.
I know with a textbox:
you can use something like if (textbox.text = <=0)
errorprovider.seterror(textbox,"you must enter data");
but with a checkbox am unsure of how to use
thank you
|
|
|
|
|
Um, have you tried:
errorProvider1.SetError(checkBox1,"Goodbye");
Works for me?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
johnnysmith1 wrote: but with a checkbox am unsure of how to use
That is dependent on the application of each checkbox.
|
|
|
|
|
Thinking about it more, just what error are you going to show for a checkbox? "This checkbox must be checked?" or "This checkbox must not be checked?"
Smacks of "Do not press this button" buttons to me.
I suspect it would be better for your user if you disable the checkbox when it can't be changed, rather than tell him he did something wrong.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|