|
I've never worked with FoxPro, but to me it seems odd to specify the name of the database file (22.dbf) in an alter table statement. Shouldn't it be the name of the table you want to modify, like:
ALTER TABLE TEST ADD COLUMN TEST1 c(10) NULL
|
|
|
|
|
I know this one is going to be a hard one. I need to populate a treeview with an XML file. I also need to save the contents of that same treeview to an XML file. The contents inside of the treeview will be user driven. Therefore, the number of entries within the XML file will never be absolute. I need some kinda of dynamic loader and exporter. Any ideas? I have searched all over the web, but I have yet to find what I am looking for. Thanks in advance.
P
|
|
|
|
|
It is unclear if you are talking about a specific XML format, or XML files in general.
Anyway, this should work: Load the XML file into an XmlDocument and walk though it adding tree nodes as you encounter elements. You can also use an XML loader, which might be better for large files.
Is it a specific XML format you might be better of with a data mapper able to serialize and deserialize the XML into an object model.
Be careful when populating a tree with many nodes - it can be a performance problem - it might be better to add the child nodes "on demand" as the tree is expanded.
For writing, walk though your tree and write to an XML Writer (or build a new XmlDocument, then save that)
|
|
|
|
|
|
I am using:
using System.Configuration;
and would like to refer to the appsettings in the app.config
How can I do this in .net 2.0
The intellisense does not show ConfigurationManager
Thanks
|
|
|
|
|
This is because you did not reference the system.configuration.dll assembly. In .NET 2.0, the System.Configuration namespace is spread across System.dll and System.Configuration.dll
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
hey howzit,
i have an .EMF image (its just text) sitting in a picturebox. its about a4 in size (so when in runtime mode it covers half the width and more than the height of the screen).
problem is i can't see the text, so i need to beable to enlarge the image to fit the full width of the screen WITHOUT LOOSING quality or resolution i.e. i wanna have the same zoom in/zoom out functionality that Windows Picture & Fax viewer has.
can you help?
|
|
|
|
|
Hello, there. I'm looking for a way to remove the last tag in an XML file in a fairly quick manner. Here's the scenario. I have an XML file used as a session log of an application. You can include one or more session logs in the same file, so I have the following format for the XML:
<SessionLogs>
<SessionLog date="01/24/2006" time="6:45:31 AM">
<SessionEntry>
<Data> ... </Data>
</SessionEntry>
</SessionLog>
</SessionLogs>
The session log file can be quite large so I don't want to read it into an XMLDocument object, chop the last tag, and write the file back out just to remove one line from the file. Also, since the file can be large, I was hoping that I wouldn't have to parse through the whole thing to get to the end for one line. Does anyone know how this could be best accomplished? Is there a way to seek backwards through a file stream (i.e. after the file has been opened in Append mode) by one line and remove the line? Any suggestions would be greatly appreciated. Thanks.
Rick
-- modified at 7:53 Tuesday 24th January, 2006
|
|
|
|
|
Use the XmlTextReader class. When you are positioned to the SessionLog node, call the XmlTextReader.ReadOuterXml, which will return a string representing the XML of the current node.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Hi, Michel. Thanks for the suggestion. Would this in essence place the whole XML document in memory in one string or am I misunderstanding how XmlTextReader would work? I was trying to avoid placing the whole document in memory if possible because of the size of the XML file. Perhaps I'm misunderstanding how this really works. Thanks.
|
|
|
|
|
I don't know the exact inner workings of XmlTextReader, but I can tell you it does not read the entire XML. XmlTextReader.Read() allows you to move to the next node (look at XmlNodeType enumeration to see all the node types).
I am sure that this is far more efficient than XmlDocument.
You could make an experiment: try both methods with a very large document and see which is faster. Try with both experiment with the same file at the same location on disk.
I could bet 20$ that XmlTextReader will win the race.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
I agree with the performance entirely. One other thought. XmlTextReader gets me to the position in the file, but then what do I do with it? XmlTextReader provides read only access to the file. How do I end up stripping the last tag from the file if XmlTextReader doesn't read the whole XML document into memory for me to write back out (minus the ending tag, of course)? Perhaps I'm still missing something obvious.
-- modified at 15:37 Tuesday 24th January, 2006
|
|
|
|
|
When you are positioned in the correct node, after a number of calls to XmlTextReader.Read() and XmlTextReader.Name, when you realize you are on the node you want, make a call to XmlTextReader.OuterXml() to get a System.String object containing the XML within the <SessionLog> node only.
Look at the XmlTextReader documentation, you find it is very easy. For instance.
while (myReader.Read())
{
if ((myReader.NodeType == XmlNodeType.Element) && (myReader.Name == "SessionLog"))
{
return myReader.OuterXml();
}
}
This is not the most elegant code, but it is to illustrate the use of the XmlTextReader for your needs.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Can you see how I can get this code to compile please?
public string SmtpServer
{
set
{
System.Web.Mail.SmtpMail.SmtpServer = value;
}
}
may be I should use something like:
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(value);
if so then how do I set SmtpServer?
Thanks
|
|
|
|
|
Hi,
I am converting a 1.1 code to 2.0
The line that I would like to convert is
System.Web.Mail.SmtpMail.SmtpServer = SMTPserverName;
P.S. using outlook
do you know what should this line be in 2.0 ?
Thanks
|
|
|
|
|
If you're using the System.Web.Mail classes, you're not using Outlook. You're using the CDOSYS library, or CDONT on NT 4.0.
In .NET 2.0, you can continue using System.Web.Mail which will continue to use CDOSYS/CDONT. The new version of the framework adds a new namespace, System.Net.Mail, which implements the SMTP protocol directly in managed code. To send mail, you need to create an instance of the SmtpClient class. You can pass the SMTP server name to the constructor.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I can not get this to work
public new void To(string email)
{
base.To = email;
}
the error is:
can not implicitly convert type string to system.net.mail.mailaddresscollection
Thanks
|
|
|
|
|
The To property is a collection, so you need to say base.To.Add(email);
I'm not that familiar with System.Net.Mail - I only really know that it exists. I've used System.Web.Mail a couple of times.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I have made a client-server application, and I would like to have a messenger like popup message just over the taskbar on the client, that will notify me when ever changes has been made on the server.
How do I make this popup notifycation?
I hope someone can help... thanks
modified 2-Feb-21 21:01pm.
|
|
|
|
|
i had created a taskbar pop up
u can use the following code
u need to add this form in ur project and call it when
u want to display the pop up message
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Reflection;
namespace TaskBarPopUp
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
private string contenttext;
Timer timer;
bool Displayed = false;
private System.Windows.Forms.Label lblContent;
Point po;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.BackColor = Color.CornflowerBlue;
lblContent.BackColor = Color.CornflowerBlue;
this.Opacity = 0;
timer = new Timer();
timer.Interval = 100;
timer.Tick += new EventHandler(timer_Tick);
po = new Point(MousePosition.X,MousePosition.Y);
//
// 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.lblContent = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblContent
//
this.lblContent.Font = new System.Drawing.Font("Bookman Old Style", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblContent.Location = new System.Drawing.Point(0, 0);
this.lblContent.Name = "lblContent";
this.lblContent.Size = new System.Drawing.Size(368, 96);
this.lblContent.TabIndex = 0;
this.lblContent.Text = "This is a Pop Up";
this.lblContent.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblContent.MouseEnter += new System.EventHandler(this.lblContent_MouseEnter);
this.lblContent.MouseLeave += new System.EventHandler(this.lblContent_MouseLeave);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.ClientSize = new System.Drawing.Size(368, 93);
this.ControlBox = false;
this.Controls.Add(this.lblContent);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Form1";
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.TopMost = true;
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
public string Content
{
get{return contenttext;}
set{contenttext = value;}
}
public void SetContent(string str)
{
lblContent.Text = "You Have Received A Message From \n"+ str;
contenttext = str;
}
public void Show(int TimeToShow, int TimeToStay, int TimeToHide)
{
}
private void lblContent_Click(object sender, System.EventArgs e)
{
}
private void Form1_Load(object sender, System.EventArgs e)
{
Rectangle workArea = Screen.GetWorkingArea(this);
SetBounds(workArea.Width - this.Width-5,workArea.Height - this.Height, this.Width , this.Height);
timer.Start();
}
private void timer_Tick(object sender, EventArgs e)
{
if(Displayed == false)
{
this.Opacity += 0.1;
if(this.Opacity == 1)
{
Displayed = true;
}
}
else
{timer.Interval = 1;
if(po.X >= this.Location.X && po.Y >= this.Location.Y)
{
timer.Stop();
}
if(this.Opacity >=0.1)
this.Opacity -= 0.01;
if(this.Opacity >= 0 && this.Opacity <= 0.1)
{
timer.Stop();
Application.Exit();
}
}
}
private void lblContent_MouseLeave(object sender, System.EventArgs e)
{
lblContent.ForeColor = Color.Black;
Displayed = true;
this.Opacity = 1;
timer.Start();
}
private void lblContent_MouseEnter(object sender, System.EventArgs e)
{
string txt = lblContent.Text;
lblContent.ForeColor = Color.White;
timer.Stop();
Displayed = false;
this.Opacity = 1;
}
}
}
|
|
|
|
|
|
I have developed a TextBox Control with some customized features by inheriting the Default TextBox Control. The problem is, when i added the control to the form the designer fails to show any control in the form including the developed control. But the designer can show all the controls if i remove that control. How can i provide design time support to the control so that is remains visible in design time .
Thanks in advance.
|
|
|
|
|
have u added the textbox control through the code ?
if u have done this way the textbox will not be visible during
the design time.
but it will be visible at runtime.
Regards,
Pramod
|
|
|
|
|
I need a form that will popup next to a button. For instance, say I have a volume button on a form but I dont want to put the controls for the volume on the form. Instead, I push the volume button and a little form pops up next to it that has all of the necessary volume controls. Furthermore, I dont want it to perform like a conventional form. I dont want it to show up in the task bar and I need its location to always be next to the button that instantiated it. I have seen this on several applications, including Fireworks and Photoshop. Any ideas? Thanks.
P
|
|
|
|
|
u can create a form and set it's ShowInTaskbar property false,
and call the Show method of the form in the MouseDown of the Button.
later u can access the form and do as u wish
Regards,
Pramod
|
|
|
|