|
Your browser does that - only it renders it. You can, in your browser, select "File -> Save As" and save it as an HTML page, then open it up in a vanilla (plain) text editor.
If you want to do this programmatically, see the example in the documentation for the HttpWebRequest.GetResponse[^] method. Just save it to a file instead of using the Console .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank You very much Mr. Heath Stewart!
Exactly i needed!
Thank You again
Enricop
|
|
|
|
|
You can also use RegEx to strip the html tags from the response.
<br />
public string cleanHtmlTags(string inputText)<br />
{<br />
Regex objRejex = new Regex("<([^>]*?)>");<br />
return objRejex.Replace(inputText, "");<br />
}<br />
"If knowledge can create problems, it is not through ignorance that we can solve them." -- Isaac Asimov
|
|
|
|
|
I have a web page with dynamically geneated textboxes and buttons. On click of a button, I want to pull the values from the database and populate the textboxes. I am gettinng confused between the sequence in which the client and server side code gets called. If I call server side first and then client, practically it happens in opp order . For eg-
TableCell tblCell5 = new TableCell();
System.Web.UI.WebControls.Button btn = new System.Web.UI.WebControls.Button();
btn.Text = "Copy";
btn.ID = "btnFetch"+ count.ToString();
counter = count;
btn.CommandArgument = count.ToString();
btn.Command += new CommandEventHandler(RemoveFiles);
btn.Attributes.Add("onclick","setit(" + count + "," + crash +","+ cr +","+ cav+"); ");
tblCell5.Controls.Add(btn);
tblRow.Cells.Add(tblCell5);
Even if I call in this order and set the values of variables in RemoveFiles, the javascript functions gets called first and by that time, the variables are not set.
Also if I try to call javascript from server side function, he javascript function is not yet loaded. For eg-
protected void RemoveFiles(Object sender, CommandEventArgs e)
{
stag = 1;
Response.Write(" alert("+ e.CommandArgument.ToString() +")");
cr = 6;
cav = 9;
hrs=10;
crash = 6;
Response.Write(" setit(' + count + ',' + crash +','+ cr +','+ cav+'); ");
}
Any suggestions?
|
|
|
|
|
I have added a button and a text box onto a form with no methods within the form...I would like to click the button and perform a simple formula of 2*2 and output the answer to the textbox?..just to get me started!
any Ideas Thanks..
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication2
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textBox1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(64, 56);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(72, 32);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox1
//
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.textBox1});
this.groupBox1.Location = new System.Drawing.Point(16, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(256, 240);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "groupBox1";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(56, 120);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(56, 20);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "textBox1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button1,
this.groupBox1});
this.Name = "Form1";
this.Text = "Form1";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
//Draws the image to fit the ClientRectangle area of the form.
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
}
}
}
|
|
|
|
|
private void button1_Click(object sender, System.EventArgs e)
{
TextBox1.Text = Convert.ToString(2*2)
}
|
|
|
|
|
Cheers How do you implement a for loop in c# ?
Thanks Jay
ps cheers for your help!!
|
|
|
|
|
the same way as c/c++/java
for (int i = 0;i<10;i++)
{
}
you really need to eitehr buy a book, or google yourself a decent tutorial though.
|
|
|
|
|
How to capture 'editing whichever cell in datagrid' event? And how to recover number of row and column cell that has just been edited?
thank you for help
|
|
|
|
|
I'm returning a datatable from the DB, I need to add a row to that datatable for display only. That piece is working fine, the issue is I need that record to be the first record displayed in the cbo box.
System.Data.DataRow dr = WorkTable.NewRow();
WorkTable.Rows.Add(new object[] {"ALL", "AL","","","","","","",-2,1,"UNKNOWN"});
cbo.DataSource = WorkTable;
--I need to have the added line first in the combo box.
Thanks
|
|
|
|
|
Instead of setting the data source of the combobox to the table, set it to a sorted view. Then all you need to do is make sure that the view is sorted so that your new row is first ... perhaps by adding a new column to the table that is null for everything other than your new row. I tried this quickly, and seems to work OK, but it looks like the sort put's null values ahead of non-nulls, so you'll need to do a descending sort.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
We have an app that will not run on a single computer from the network (works fine locally). I have adjusted .NET security setting the Local Intrenet to Full Trust, but the app still crashes when trying to launch.
Any other ideas?
|
|
|
|
|
How do you start the application, exactly?
If you're trying to run it from a UNC path, then the internet zone security settings will apply, even if the computer is in your local intranet.
Regards,
mav
|
|
|
|
|
We browse to the network path (e.g. Z:\C# Stuff\Program Folder\Program.exe) and run it directly.
This is the only computer that will not run it from the network (we have 50+ that run it just fine).
-- modified at 14:04 Tuesday 4th October, 2005
The .NET internet security settings are full trust also.
|
|
|
|
|
The problem turned out to be some network glitch with the user's profile (on the network itself).
Our I.T. dept is checking into the fix.
Thanks for your help
|
|
|
|
|
Dear All,
I want to check the CPU Usage in C#. May be through Perfprmance counters?? Can I get sample code for that.
With Regards
Manoj
|
|
|
|
|
What type of CPU usage you want to check is important. You can browse the various performance counters and read their descriptions using the Server Explorer tab in Visual Studio - right-clicking on the perf counter you want and select Properties - or use perfmon.exe o NT-based Windows OSes.
An example of just getting values every .5 seconds follows:
using System;
using System.Diagnostics;
using System.Threading;
class Usage
{
static void Main()
{
using (PerformanceCounter pc = new PerformanceCounter())
{
pc.CategoryName = "Processor";
pc.CounterName = "% User Time";
pc.InstanceName = "_Total";
Console.Error.WriteLine("Total % User Time:");
Console.Error.WriteLine("Press any key to exit...");
ThreadPool.QueueUserWorkItem(new WaitCallback(Count), pc);
Console.Read();
Console.Error.WriteLine("Done");
}
}
static void Count(object state)
{
PerformanceCounter pc = state as PerformanceCounter;
while (pc != null)
{
Console.WriteLine("{0,3:f2}%", pc.NextValue());
Thread.Sleep(500);
}
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks you lot.
Actually I want to implement cluster. in which I want to check CPU Usage before assigning it to computation.
With Regards
Manoj
|
|
|
|
|
You can still use the performance counters and should consider taking a brief running average before giving more work to a CPU. CPU usage goes up and down and performance counters only have so much resolution between ticks (no where near as fast as a CPU tick).
There is actually APIS for clustering in Windows available either as automation objects (which you can use with a Runtime-Callable Wrapper (RCW) created by tlbimp.exe) or native functions you can P/Invoke. See http://msdn.microsoft.com/library/en-us/mscs/mscs/windows_clustering.asp[^] for details.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello,
I have an MDI application. At the start of Main I call EnableVisualStyles and DoEvents to enable XP theming and everything works fine.
But now, I'm trying to automatically simulate a click event for a menu item to display a login form on top of that MDI parent.
First I tried to display the form the first time the Activated event is fired for the MDI parent, and it kind of works, but the main form is displayed partially resized (titlebar is resized to saved position, but not client area) and only totally paints itself after the login form is closed.
I have a timer, so I tried setting a flag and displaying the form the first time the Tick event fires for the timer, before clearing the flag. This to wait for the form to process all the creation events. And it works perfect, except that I don't get visual styles in any of my application's dialogs (but I do in toolbars and message boxes.)
I'm using .NET 1.1 (VS 2003) on Windows XP.
So, any ideas?
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I just removed the calls to EnableVisualStyles and DoEvents and added an app.manifest file. Everything works great now!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Hi!
You could also try using the Application.Idle event instead of your timer. That way the menu item click is simulated when the application is finished initializing the main form.
Regards,
mav
|
|
|
|
|
I am new to remoting and have created 3 projects on the same machine
1) Server object
2) Server activation object
3) Client
The client calls the server activation object which includes specifying a URI to show where the Server activation application resides. This client code might look something like this...
TcpClientChannel ch = new TcpClientChannel();
ChannelServices.RegisterChannel(ch);
RemotingConfiguration.RegisterWellKnownClientType(
typeof(SAO_server_single_call.clsSAO_singlecall),
"tcp:davelaptop:1234/clsSAO_singlecall");
objSAO_singlecall = new SAO_server_single_call.clsSAO_singlecall();
Can anybody tell me how to work out how the URI should be constructed? I've not used them much before. My computer is called 'davelaptop' and the client activation server project lives at 'D:\Work\Exercise\RemotingTest\RemotingTest\TestServer'
Can anyone tell me what the URI should look like or tell me where I'm going wrong?
Thanks in advance - Dave
|
|
|
|
|
The URI doesn't have anything to do with the physical location of the server. You only need to provide the port number of the channel which you registered on the server. For example, if your server code looked like this
ChannelServices.RegisterChannel(new TcpChannel(8082));
RemotingConfiguration.ApplicationName = "HelloServiceApplication";
RemotingConfiguration.RegisterWellKnownServiceType( typeof(HelloService),
"MyUri",
WellKnownObjectMode.SingleCall
);
Then the client call will look like
RemotingConfiguration.RegisterWellKnownClientType(
typeof(SAO_server_single_call.clsSAO_singlecall),
"tcp://localhost:8082/HelloServiceApplication/MyUri");
Quoted from MSDN[^]
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
im using visual studio beta 2
i have richtextbox and listbox in my C# windows application.
my application works like intellisense/Autocomplete like typing System, then a "."
inside Visual Studio .NET will show a drop down list of types for the System namespace.
when i type a recognized word into the richtextbox then a period/fullstop,
a listbox appears.
problem:
how do i position my listbox to appear right after the period('.') i would have typed in my richtextbox
code example would be appreciated
thanks
regards paula
|
|
|
|