|
And from the namespace used, he did.
Bob Dole The internet is a great way to get on the net.
![D'Oh! | :doh:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_doh.gif) 2.0.82.7292 SP6a
|
|
|
|
|
Zac Greve wrote: And from the namespace used, he did.
Yes, sorry you are correct.
|
|
|
|
|
I am using a custom layout that is correct, the references that code uses are there as I loaded log4net through Nuget.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
No, add the name of the assembly with the custom layout to the end of the layout namespace thing. e.g.
<layout type="My.Cool.Namespace.And.Sub.Namespace.And.Sub.Sub.Namespace.Layouts.MyLayout, MyAssembly">
</layout>
(Not that I use that many namespace, nor should you, I just am sorta hyper right now. *Bounces off another wall, "BONK"*)
Bob Dole The internet is a great way to get on the net.
![D'Oh! | :doh:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_doh.gif) 2.0.82.7292 SP6a
|
|
|
|
|
The logger code and Custom Pattern Code are in the same assembly, The app config is in WinForms project. This code worked / works on XP but I have recently upgraded my works machine to Windows 7.
I think when I get to work on Monday that I'll give the NLog a go.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Look here.[^]
The second example should help you.
Bob Dole The internet is a great way to get on the net.
![D'Oh! | :doh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_doh.gif) 2.0.82.7292 SP6a
|
|
|
|
|
Presumably it works if you do NOT call ChangeLogFile?
Why don't you just add the path to your the log4net config file rather than attempting to do it dynamically?
Presumably you call ChangeLogFie BEFORE you instantiate or reference any files that uses logging?
|
|
|
|
|
I do a dynamic log file name so that I can separate the logging by day.
The logger creates the file that I need each time, but when I try to write entries too it, nothing appears and no error messages are generated about the logger.
the annoying thing is that this worked like a charm in XP now I moved it too Windows 7 it stops
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Simon_Whale wrote: I do a dynamic log file name so that I can separate the logging by day.
That doesn't answer my question.
|
|
|
|
|
I have a datatable with a column of values, and I need to source a corresponding value from another datatable. Durrently, I'm doing this :-
string SuppRef = null;
if (DtSet.Tables.Contains("tblAccounts"))
{
foreach (DataRow row in dtMain.Rows)
{
if (row[1].ToString() == "")
{
SuppRef = row[5].ToString();
foreach (DataRow r in DtSet.Tables["tblAccounts"].Rows)
{
if (r[0].ToString() == SuppRef)
{
row[1] = r[1].ToString();
}
}
}
}
}
So, where a value is missing from column 1, I search for the value in column 5 in the second datatable, and return the corresponding value.
I was wondering is there was an alternative way to approach this, maybe something similar to Excel's Vlookup or Find?
Thanks in advance.
|
|
|
|
|
Hi
Can you please elaborate exactly how you want the result with an example.
Regards
Naina
Naina
|
|
|
|
|
I'm not sure if this is what you mean, but what I'm doing is :-
Before
dtMain
Col 1 Col 5
null 1111
tblAccounts
Col 0 Col 1
1111 2222
After
dtMain
Col 1 Col 5
2222 1111
tblAccounts
Col 0 Col 1
1111 2222
|
|
|
|
|
Hi
Just try this code
foreach (DataRow row in dt.Rows)
{
int colcount = dt.Columns.Count;
for(int i = 0; i<colcount; i++)
{
if ((row[i] == null || row[i].ToString() == ""))
{
foreach (DataRow row1 in dt1.Rows)
{
row[i] = row1[i].ToString();
}
}
}
}
dt is datatable1 and dt1 is datatable2
Regards
Naina
Naina
|
|
|
|
|
Hello,
I have a fixed XML table thats coming from a Web Service.
<Loan>
<Name>JOHNSON, DANIEL R.</Name>
<Number>BMRES-550</Number>
<BankName>Bank of America</BankName>
<ClosingNo>123456</ClosingNo>
<FundsToSendAmt>49,7560.8600</FundsToSendAmt>
</Loan>
I need to convert the XML data to CSV. The data to be converted has commas. So the below method doesn't work:
using (StreamWriter writer = File.CreateText("C:\\username\\password\\Desktop\\Export.csv"))
{
DataSet ds = new DataSet();
ds.ReadXml(XmlReader.Create(new StringReader(myWebreference.GetWebServiceMethod("username", "password1", "Export", "Parameter4", DateTime.Today, DateTime.Today, ""))));
writer.WriteLine(string.Join(",", ds.Tables["Loan"].Columns.Cast<DataColumn>().Select(col => col.ColumnName).ToArray()));
foreach (DataRow row in ds.Tables["Loan"].Rows)
{
writer.WriteLine(string.Join(",", row.ItemArray.Cast<string>().ToArray()));
}
}
|
|
|
|
|
Why not convert comma's to something that wont be in your data like ~ ?
Frazzle the name say's it all
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
John F. Woods
|
|
|
|
|
Actually this might be more what I'm looking for:
public class WireEntry
{
public String Name { get; set; }
public String Number { get; set; }
public String BankName { get; set; }
public String ClosingNo { get; set; }
public WireEntry()
{
}
}
foreach (DataRow row in ds.Tables["Loan"].Rows)
{
WireEntry newEntry = new WireEntry();
newEntry.Name = row["Name"].ToString();
newEntry.Number = row["Number"].ToString();
newEntry.BankName = row["BankName"].ToString();
result.Add(newEntry);
}
return result;
|
|
|
|
|
Maybe I am wrong but you still need to strip out the comma's from the incoming data. Or possibly I didn't understand your task.
I was thinking string.Replace(",","comma");
Frazzle the name say's it all
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
John F. Woods
|
|
|
|
|
What do you do with the CSV when you're done? Why use CSV?
0) Use a different delimiter (Good).
1) Wrap the values in quotes (better).
2) I'd prefer to save the XML and then use XSLT to form the CSV.
|
|
|
|
|
Actually thats a good question. Because I'm not really wanting the end file to be a CSV file. The end file should be in FedWire Format.
http://www.frbservices.org/campaigns/remittance/files/fedwire_funds_format_reference_guide.pdf[^]
I just figured it would be easier to get to my end result with a CSV file to work with.
Basically I'm taking that Web Service. Iterating through the tables. Then ultimately spitting out a file in that format.
{1015} blah blah blah {1870} blah blah blah
|
|
|
|
|
Cut out the middlemen (including the DataSet).
Look into XSLT to transform the XML to FedWire directly. I can probably help, but I won't read that document until I get home.
|
|
|
|
|
Hmmm Ok. Thanks for the brainstorming. Guess i dont need a dataset at all if XLST can give me both displaying the data in a meaningful manner front end while also being able to convert the data and spitting it out to a file, which it sounds like it can. I look into it until you get back to me. ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
RickSharp wrote: The end file should be in FedWire Format.
The posted link is not a Protocol structure document. It looks like a mapping document.
|
|
|
|
|
Normal form for "CSV" is to put double quotes around values that have commas.
With double quotes the value is also surrounded by double quotes and each double quote in it is then escaped with two double quotes.
|
|
|
|
|
When the tabpage added the form in it, and the tagpage resize, the form can't fill the tabpage. i haved setup the form.dock = dockstype.fill, but seem that is no usefull. any one can gave me clue?
Examples.
Form2 form = new Form2();
TabPage tbPage = new TabPage();
tbPage.Text = "test";
tbPage.Name = "page1";
tbPage.BackColor = SystemColors.ControlText;
Panel panel = new Panel();
panel.Dock = DockStyle.Fill;
tbPage.Controls.Add(panel);
tabControl.TabPages.Add(tbPage);
form.TopLevel = false;
form.Parent = panel;
form.Show();
tabControl.SelectedTab = tbPage;
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) Well, you can achieve this, and here's an example:
public partial class Form1 : Form
{
public Form1(){ InitializeComponent();}
private Form form2 = new Form();
private Panel pnl1 = new Panel();
private Button btn1 = new Button();
private TabPage tbPg1 = new TabPage();
private void Form1_Load(object sender, EventArgs e)
{
pnl1.BackColor = Color.SlateBlue;
pnl1.Padding = new Padding(32);
form2.TopLevel = false;
form2.FormBorderStyle = FormBorderStyle.FixedSingle;
form2.ControlBox = false;
form2.MaximizeBox = false;
form2.MinimizeBox = false;
form2.Text = "";
form2.BackColor = Color.Azure
form2.Resize += (ob, ea) =>
{
btn1.Location = new Point((form2.Width/2) -(btn1.Width/2),
(form2.Height/2) - (btn1.Height/2));
};
form2.Parent = pnl1;
form2.Dock = DockStyle.Fill;
form2.Visible = true;
btn1.AutoSize = true;
btn1.BackColor = Color.WhiteSmoke;
btn1.Text = "button on the Form";
form2.Controls.Add(btn1);
btn1.Click += (ob, ea) => { MessageBox.Show("Button on Form Clicked"); };
tbPg1.BackColor = Color.LightSteelBlue;
tbPg1.Text = "Test Form in Panel in TabPage";
tbPg1.Padding = new Padding(32);
tbPg1.Controls.Add(pnl1);
pnl1.Dock = DockStyle.Fill;
tabControl1.Controls.Add(tbPg1);
}
}
But, I wonder: why are you inserting a Form in a Panel which is then inserted in a TabPage ?
In general, you should not be using a Form inside any other Container Control, including another Form: Forms are "heavy-weight" .NET objects, and really are not meant to be used this way.
Yes, .NET WinForms will let you "get away with it," but that does not mean it is good practice. If you really need to design the contents of TabPages in their own designer, outside of the TabControl itself, why not use a UserControl, a "lighter-weight" object ?
To change from using a Form, to using a UserControl in the above example, is as simple as making these changes to the code:
1. private UserControl form2 = new UserControl();
... of course, being a good programmer, you will change form2's name to something more mnemonic !
2. comment out the following four lines in the Form_Load EventHandler, like this:
//form2.FormBorderStyle = FormBorderStyle.FixedSingle;
//form2.ControlBox = false;
//form2.MaximizeBox = false;
//form2.MinimizeBox = false;
If you share something about your design goals here, I'd be happy to respond with suggestions, and I am sure that other CP Members will also respond.
yrs, Bill
|
|
|
|