|
Thank you for your help..
How I got it to work.
created a new element,
assigned the old node to a new node specific to my search criteria
newnode = root.SelectSingleNode("Students/Student/[@userid='" + loginform.userid + "']");
I then created a new attribute
and used the append function to add the newly created attribute as the last attribute.
saved the document... and it worked..
hope this help someone....
thanks again.
JC
|
|
|
|
|
how to create a C# program that directly controls the activity of the computer such as creating a folder, deleting a file etc.
|
|
|
|
|
For creating folders, deleting files, file properties, etc, take a look at the System.IO namespace.
|
|
|
|
|
And try reading the 'how to get an answer to your question' sticky post at the top of the forum.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i dont know what to do to this one.. can someone tell me the codes for this.. from a multiline textbox save to a ms word format in the database..
ginji
|
|
|
|
|
Well, if you want to create a doc, you can go the docx route and work out hte format, or you can use the Microsoft toolkit for Office to create a word doc. Of course, Word will read your multiline text file anyhow.
And the database is a whole different, unrelated step.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
how?? im just new at c# and im just learning it little by little
ginji
|
|
|
|
|
Sounds like you need to learn some basics before you worry about databases and word documents.
Like I said, Word can read your txt file.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I want to be able to save myself writing a lot of code and use the CodeDOM to do some dynamic generation. I'll try my best to explain it :-/
I have several classes all which have a "Create" method and all create different windows components for example
Class ButtonControl
{
public static void Create(ButtonValues values, Button button)
{
button.Text = values.Text;
...
}
}
Class LabelControl
{
public static void Create( LabelValues values,Label button)
{
Label.Text = values.Text;
...
}
}
Then i want to be able to dynamically call one of these from a function like
void CreateControl(string TYPE, Control selected)
{
TYPE.Create(values, selected);
}
And i don't have any idea how to pass the parameters like that with the CodeDOM i have little experience with it, any help would be appreciated
|
|
|
|
|
CodeDOM is for generating code, which you can then compile and run.
It sounds like you are looking to create controls at runtime, you might be better served with Activator.CreateInstance(...) and the System.Reflection namespace.
|
|
|
|
|
Thanks, i managed to do it very easily with reflection
|
|
|
|
|
Hi there.
Already I was using PHP .
In PHP we can get program's number line, for example the following code writes 9 in out pot.
1 <?php
2
3
4
5
6
7 8
9 echo __LINE__;
10
11
12
13 ?>
Now , I want to know whether we can get program's number line in C# when the program is running?
Freshman
|
|
|
|
|
M-Dayyan,
AFAIK, I don't think you can. Whats the reason you want to print out the line number?, i am guessing its debugging related?
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Hi,
it is possible, but not very easy; there is no predefined symbol as in C/C++.
you can figure out where you are (and how you got there) by reading
Environment.StackTrace; you could even create a method that takes the second
entry (skipping the method itself) to extract the classname, methodname, and
line number.
The line numbers may or may not be present depending on circumstances such
as debug/release build.
|
|
|
|
|
Thanks Luc Pattyn.
Freshman
|
|
|
|
|
you're welcome.
|
|
|
|
|
I must using
StackFrame CallStack = new StackFrame(0, true);
Console.Write("File: " + CallStack.GetFileName() + ",
Line: " + CallStack.GetFileLineNumber());
Freshman
|
|
|
|
|
I am trying to update my Access and I am recieving an Error:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace ProspectorV100
{
public partial class frmProspectMaint : Form
{
OleDbConnection cnADONETConnection = new OleDbConnection();
OleDbDataAdapter daContactsCombo;
OleDbCommandBuilder cbContactsCombo;
DataTable dtContactsCombo = new DataTable();
int row;
long intContactID;
public frmProspectMaint()
{
InitializeComponent();
}
private void frmProspectMaint_Load(object sender, EventArgs e)
{
cnADONETConnection.ConnectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Prospector\Database\prospect.mdb";
cnADONETConnection.Open();
daContactsCombo =
new OleDbDataAdapter("Select * From Contacts Order by Last_Name", cnADONETConnection);
OleDbCommandBuilder cbContactsCombo = new OleDbCommandBuilder(daContactsCombo);
daContactsCombo.Fill(dtContactsCombo);
this.LoadSearchBox();
}
private void LoadSearchBox()
{
for (int x = 0; x < dtContactsCombo.Rows.Count; x++)
{
tlsSearch.Items.Add(dtContactsCombo.Rows[x]["Last_Name"].ToString() + ", " +
dtContactsCombo.Rows[x]["First_Name"].ToString());
tlsSearch.AutoCompleteCustomSource.Add(dtContactsCombo.Rows[x]["Last_Name"].ToString() + ", " +
dtContactsCombo.Rows[x]["First_Name"].ToString());
}
}
private void frmProspectMaint_FormClosed(object sender, FormClosedEventArgs e)
{
cnADONETConnection.Close();
cnADONETConnection.Dispose();
}
private void tlsSearch_SelectedIndexChanged(object sender, EventArgs e)
{
row = tlsSearch.SelectedIndex;
intContactID = Convert.ToInt32(dtContactsCombo.Rows[row]["Contact_ID"].ToString());
txtFirstName.Text = dtContactsCombo.Rows[row]["First_Name"].ToString();
txtLastName.Text = dtContactsCombo.Rows[row]["Last_Name"].ToString();
txtCompany.Text = dtContactsCombo.Rows[row]["Company_Name"].ToString();
txtJobTitle.Text = dtContactsCombo.Rows[row]["Job_Title"].ToString();
}
private void tlsSave_Click(object sender, EventArgs e)
{
//If there is existing Data Update it
if (row >= 0)
{
dtContactsCombo.Rows[row]["Contact_ID"] = intContactID;
dtContactsCombo.Rows[row]["Last_Name"] = txtLastName.Text;
dtContactsCombo.Rows[row]["First_Name"] = txtFirstName.Text;
dtContactsCombo.Rows[row]["Company_Name"] = txtCompany.Text;
dtContactsCombo.Rows[row]["Job_Title"] = txtJobTitle.Text;
daContactsCombo.Update(dtContactsCombo);
}
}
}
}
As I stated before I am new to C# and any help would be appreciated.
|
|
|
|
|
kruegersck,
What is the error? and at which line does it happen?
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Sorry - I get an SQL Error at the line: daContactsCombo.Update(dtContactsCombo);
Syntax error in query expression '((Contact_ID = ?) AND ((? = 1 AND First_Name IS NULL) OR (First_Name = ?)) AND ((? = 1 AND Last_Name IS NULL) OR (Last_Name = ?)) AND ((? = 1 AND Company_Name IS NULL) OR (Company_Name = ?)) AND ((? = 1 AND Job_Title IS NULL) OR (Job_Title = ?)) AND ((? ='.
Thanks for all your help
|
|
|
|
|
kruegersck wrote: ((? = 1
I don't think it works like that.
kruegersck wrote: ((? =
Definately this won't work, you have two brackets ( for no good reason ) and they are not closed.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
That is the error message I am getting????
|
|
|
|
|
Yes, so the string you're using for your query, is wrong. That is what I am telling you.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Are there any good examples of doing this using Access?
Thanks Again.
|
|
|
|
|
I'm not sure what you mean by 'doing this', it looks to me like you're asking a SQL question and all you need to do is close your brackets. Where is the issue ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|