|
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.
|
|
|
|
|
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;
|
|
|
|
|
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
|
|
|
|
|
Hello,
I've an application which reads and writes to a shared excel using C#.
The application runs on different computers and whenever anybody writes to the excel a pop-up appears on all the computers in which the application is running and displays the recent message written to excel file.
I am using FileSystemWatcher and an event is raised whenever something is written to the file.
If this event occurs I am reading the excel file from each of the process and displaying the latest message.
Now, when I am reading the excel file from different computers(processes) at the same time. All the processes does not get the latest message.
I am opening the excel in readOnly and releasing the excel object successfully.
Also, I have found that when many processes are trying to read from the same excel at the same time. The excel tends to crash.
I have added a thread.sleep(3000) so that there is a delay in reading the excel file. This did help but still the excel throws error messages.
Is there anyway that I can read excel file one after the other from each process?
|
|
|
|
|
what is the error message? or COM exception code?
Is there any inner exception?
These are valuable tips on what the problem could be!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
|
It sounds like you are taking every step possible to overcome some very common problems with network shares.
The FileSystemWatcher and sleep(3000) may not be enough. Try creating a locked file (FileStream with Non-Sharing Mode) that your "listeners" try to access. Remove the lock once the message has been added and the excel file is written.
But my guess is that you will never get rid of this problem. File access using network shares are never reliable when accessed from multiple computers simultaneously (in my experience).
|
|
|
|
|
Hello.
iam trying to read a KeyValuePair but it seems that iam doing soemthing wrong here, iam including a small part of the code where iam trying to read the value and also a capture from the debug, the debug shows me in "Locals" the info that i want to read.
var dataSourceName = (
from entry in entityParams
where entry is KeyValuePair<string, string> && entry != null && ((KeyValuePair<string, string>)entry).Key.Equals("DataSourceName")
select ((KeyValuePair<string, string>)entry).Value).FirstOrDefault();
I did not find a way to upload and include a image in this post, so i added it external instead.
Link to image
In this debug case its the value "ps3" that i need.
I have added the .dll switchking.common to my references and also
using SwitchKing.Common.Entities;
But now i need help what i need to do more to have access to the value.
|
|
|
|
|
It's not clear what yout problem is, but it looks like your criteria is to look for KeyValuePair<string, string=""> whereas the data is another type (KeyValuePair)(no generic clause! different type!)
BTW a let statement will make things cleaner
(
from entry in entityParams
let kv = entry as KeyValuePair
where kv != null && kv.Key = "DataSourceName"
select kv.Value
)
.FirstOrDefault();
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Thanks for the reply.
this is the error message that i receivs if i runt the code you posted.
The as operator must be used with a reference type or nullable type ('SwitchKing.Common.Entities.KeyValuePair' is a non-nullable value type)
|
|
|
|
|
You forgot to mention it's a compiler error!
mm... KeyValuePair is a value type!
the 'as' operator doesn't work with value type, because
'obj as type' evaluate as null is obj is not of type type, which is not possible with value type (they can't be null!)
scrap the 'as' too bad, try
(
from entry in entityParams
where entry is KeyValuePair
let kv = (KeyValuePair)entry
where kv.Key == "DataSourceName"
select kv.Value
)
.FirstOrDefault();
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Thanks for the help, that solved my issue.
|
|
|
|
|
hi guys
i want connect and disconnect to internet by exist connection in the c#
how can i connect and disconnect to internet by exist connection in the c# ?
please guide me
thanks a lot
|
|
|
|
|
What do you mean "connect to internet"? You need to know what destination you are going to connect to, and how you will communicate to it. Please give some more detail of your problem.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
apadana_1989 wrote: how can i connect and disconnect to internet by exist connection in the c# ?
You can't using the standard definition of the terms you are using.
By definition if you close a connection it is done. It can't be used again.
Guessing what you might really want...
If you want the client box to have a single connection then you could connect to another server, and use it as an intelligent proxy to issue commands for you. So that server does the connect/disconnect and just redirects traffic to the client. But the server MUST exist for this to work.
If you are referring to a wireless/VPN/modem 'connection' via which your client app tunnels IP traffic then normally it stays up anyways. But if you want to control it explicitly because it is closing then you would need to get the API for that specific thing (wireless/VPN/modem) and control it yourself.
|
|
|
|
|
Hello folks,
Happy New Year!!!
I have a class that has couple of properties.
Can I have a property in that class that can be a collection. Like say the MarketData. can I have a property say "FailedCurves" . It is a string property. But only thing is, this property is an ArrayList or Dictionary object that can have multiple string items in it.
How can I do that in C#? Am I thinking correct?
Thanks much
public class MarketData
{
#region "Private Data Members"
private int _countAdvanceCurve;
private int _countAdvancesSBCAgencyCurve;
private int _countAdvancesSBCAAACurve;
private int _countFhlbsfTreasuryCurve;
private int _countDNCOCurve;
#endregion "Private Data Members"
#region "Public Data Members"
public int CountAdvanceCurve
{
get { return _countAdvanceCurve; }
set { _countAdvanceCurve = value; }
}
}
|
|
|
|
|
You can have a property that is a List or Dictionary, no problem -- but you may want to make it read only.
What exactly is confusing you?
|
|
|
|
|
Yes you can have any sorts of collection in a properyt.
public ObservableCollection<int> CountAdvanceCurve
{
get { return _countAdvanceCurve; }
set { _countAdvanceCurve = value; }
}
or
public Dictionary<int,int> CountAdvanceCurve
{
get { return _countAdvanceCurve; }
set { _countAdvanceCurve = value; }
}
and so on.
|
|
|
|
|
Yes you can.
When you create a property, you can return anything you want - including objects you create as required.
For example, if you want to return only those values which are below 1000:
public Dictionary<string, int> LowValues
{
get
{
Dictionary<string, int> dict = new Dictionary<string, int>();
if (_countAdvanceCurve < 1000) dict.Add("AdvanceCurve", _countAdvanceCurve);
if (_countAdvancesSBCAgencyCurve < 1000) dict.Add("AdvancesSBCAgencyCurve", _countAdvancesSBCAgencyCurve);
if (_countAdvancesSBCAAACurve < 1000) dict.Add("AdvancesSBCAAACurve", _countAdvancesSBCAAACurve);
if (_countFhlbsfTreasuryCurve < 1000) dict.Add("FhlbsfTreasuryCurve", _countFhlbsfTreasuryCurve);
if (_countDNCOCurve < 1000) dict.Add("DNCOCurve", _countDNCOCurve);
return dict;
}
} This is one of the big advantages of Properties over fields - you do not have to store anything in a way that makes sense to the outside world. You can store in the best way for your class, and provide the outside world with the info it want, how it wants it, only when it asks for it.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Thanks much. Best forum ever. I don't think I ever posted here...
This is the finished code.
private List<string> _curveswithnodata = new List<string>();
public List<string> Curveswithnodata
{
get { return _curveswithnodata; }
set { _curveswithnodata = value; }
}
public method()
{
if (basedonsomecondition)
{
this.Curveswithnodata.Add(CurveName);
}
}
|
|
|
|
|
It's a good idea to create a new List if you are going to return it to the outside world - remember that if you return a List, you actually return a reference to the list, so any changes made to it outside the class affect the version the class is using, but without you being notified. If you return a copy of a list then the outside world can do what it likes with the list without it affecting the one your class is using and potentially buggering up your data!
private List<string> _curveswithnodata = new List<string>();
public List<string> Curveswithnodata
{
get { return new List<string>(_curveswithnodata); }
set { _curveswithnodata = value; }
} The other solution is to return a read only version:
get { return _curveswithnodata.AsReadOnly());
But that returns a different type: ReadOnlyCollection<T> rather than List<T> which generally makes it harder to work with outside the class.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|