|
That's a good solution for reading only those values you need
I think I'm going to use that one instead of the large amounts of dataAdapters.
Greetings....
|
|
|
|
|
I want to create a setup project for my application.I add a installer class to do some custom actionns after install.(Add my application to ngen.exe),so I need the path of my installed application.How can I get it in installer class.Any idea?
Mazy
No sig. available now.
|
|
|
|
|
If I'm correct, you can try Application.Startup or somethun..
This by our hands that dream,
"I shall find a way or make one!"
|
|
|
|
|
I was wondering if you figured this out as i have the same problem
|
|
|
|
|
NOt the exact answer but this return the path of helper assmebly which the think that we want:
this.Context.Parameters["assemblypath"]
Mazy
No sig. available now.
|
|
|
|
|
There is Timeout WebException occurs at the 'stream.Read' of following codes.
Process hangs after reading a few times.
Why?
(Visual Sudio.net 2003, .Net Framework 1.1, Windows XP Professional sp1)
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://download.adobe.com/pub
/adobe/acrobatreader/win/5.x/5.1/AcroReader51_KOR.exe");
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
FileStream fs = new FileStream("AcroReader51_KOR.exe", FileMode.Create);
long currSizeForThisFile = 0;
const int LENGTH = 1024;
const int OFFSET = 0;
byte[] buffer = new byte[LENGTH];
while (true)
{
/* Timeout WebException occurs after a few reading */
int rcvd = stream.Read(buffer, OFFSET, LENGTH);
if (rcvd > 0 && !enableExit)
{
fs.Write(buffer, 0, rcvd);
}
else
{
fs.Close();
stream.Close();
resp.Close();
System.Threading.Thread.Sleep(50);
break;
}
}
|
|
|
|
|
Hello, I posted a similar msg earlier and I am writing a print command in an application. All it does, is to print out a document with some headers and footers. So, I used a simple way to printout headers and footers. However, I still cannot keep track of the page numbers when I print out a document. I looked up the properties of printdocument, pagesetupdialog and printpreviewdialog, but I couldn't find any 'related' property. I also tried to keep track of page numbers in my print function (a loop to Graphics.DataString(...), but failed.
Can anyone please give me some ideas? Thanks so much!!
|
|
|
|
|
I wrote an app where I could track the page number on a very easy way.
Declare for the full app
private int page = 1;
At the end (last line) of your printDocument_PrintPage class add
++page
in your PaintDocument class just use this.page
The PaintDocument class is called from the printDocument_PrintPage class just to split up the drawing of the page in another class.
|
|
|
|
|
Thanks! That page number problem is solved.
I am now trying to get the total number of pages.
|
|
|
|
|
Oh, I solved the total page number problem too. Great!
|
|
|
|
|
I want to set the state of a button. I am trying to make a button appear to be pushed. How do I do that?
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
I don't think, that there is simple way to do this, but you can use SendMessage API function to send WM_LBUTTONDOWN message to button. It will appear pushed until you send WM_LBUTTONUP message to it (or until user does something with this button). This will also raise OnClick event.
|
|
|
|
|
Thanks. I am handling the click event, so I don't think what you suggested will work in my case. I want the button to stay pushed in response to a click event. I am an MFC developer who is giving C#.Net a try. This would have been easy in MFC. Why does .Net make simple things so hard?
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Use a checkbox and set its Appearance property to Button. I'm glad MS did that - it really is better than having a different control, becuase the behavior of the toggle button is the same as the checkbox, so why not have them be different Appearances of the same control?
|
|
|
|
|
Thanks, I knew suspected hoped there was some easy way of doing it.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Regards,
Is it possible to set a form (container)'s transparency independent of its child components and controls??
I mean if I set Form's opaque to 50% all controls get 50% opaque too while I want them still at 100%
any guid may help and is appreciated.
Thanks
-nSun
---
"Art happens when you least expect it"
|
|
|
|
|
As far as I remember, the Opacity property is declared within the Form class itself, not anything more generic. Thus, I can see 2 options:
1. Make a seperate embedded form for your controls (although I'm not sure this would work)
2. Override the paint handler for each control.
Of course, I could be wrong....
Jeremy Kimball
|
|
|
|
|
Thanks for the reply.
any other idea?
---
"Art happens when you least expect it"
|
|
|
|
|
Hi,
Having not found a good XPath tutorial out there yet, here is my question..
This is how I try to display the fisrtname of the first contact in the Contact.xml file,
Consider this code:
XmlDocument myDoc = new XmlDocument();<br />
myDoc.Load(Application.StartupPath + "\\Contact.xml");<br />
txtPrénom.Text = myDoc.SelectSingleNode("//Prenom").Value;
What am I missing here?
Thank you for your help!
Antoine
This by our hands that dream,
"I shall find a way or make one!"
|
|
|
|
|
try
txtPrénom.Text = myDoc.SelectSingleNode("//Prenom[first()]").Value;
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
SelectSingleNode returns first node matching XPath so your code should IMHO work, but only if "Prenom " is element (not attribute). To select attrbute you need to use this XPath //@Prenom . You can also use xpath like following:
Xml:
<contacts>
<contact firstname="Bill">
...
<contact>
...
</contacts>
<br /><br />
XPath: <code>contacts/contact/@firstname</code> returns 'Bill'
Great XPath tutorial is at www.w3schools.com[^].
|
|
|
|
|
|
You have the right idea, but it depends on your actual XML.
I suggest getting the node directly and looking at it. This will help answer your question.
<names><Prenom>Dog</Prenom><Prenom>Cat</Prenom></names>
XmlNode node = doc.SelectSingleNode("//Prenom");
node.Value == null
node.InnerText == "Dog"
|
|
|
|
|
Hi!
The point is that while scrolling within a datagrid, sometimes the gridloses focus with no reason because I was just scrolling.The class below simply illustrates this(while scrolling you'll get a message)
Thank you in advance.
ps: I'm using vs.net 2003.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace test2k3
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dg;
private DataTable dt;
private System.Windows.Forms.Button button1;
///
/// 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
//
dt = new DataTable();
DataColumn dc = new DataColumn("Nr");
dt.Columns.Add(dc);
for(int i = 0 ; i < 100; i++)
{
DataRow dr = dt.NewRow();
dr[0] = "row #"+i;
dt.Rows.Add(dr);
}
this.dg.DataSource = dt;
}
///
/// 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.dg = new System.Windows.Forms.DataGrid();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dg)).BeginInit();
this.SuspendLayout();
//
// dg
//
this.dg.DataMember = "";
this.dg.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dg.Location = new System.Drawing.Point(24, 16);
this.dg.Name = "dg";
this.dg.Size = new System.Drawing.Size(160, 128);
this.dg.TabIndex = 0;
this.dg.Leave += new System.EventHandler(this.dg_Leave);
//
// button1
//
this.button1.Location = new System.Drawing.Point(232, 64);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(56, 32);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(328, 173);
this.Controls.Add(this.button1);
this.Controls.Add(this.dg);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.dg)).EndInit();
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void dg_Leave(object sender, System.EventArgs e)
{
MessageBox.Show("You haven't leaved the grid.You've been just scrolling!","Is This A Bug?");
}
}
|
|
|
|
|