|
Use the OpenFileDialog[^] to get a path then convert it to string as follows...
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
string bytes = encoding.GetBytes("filepathhere");
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Dear Developers..
I have created one class ,defined public property of type "TabControl"
when i am trying to serialize it ,it gives error on this statement written in my form closing event.
XmlSerializer xmlSerializer = new XmlSerializer(SerializedClass.GetType());
There was an error reflecting type "projectname"
System.InvalidOperationException: There was an error reflecting type 'System.Windows.Forms.TabControl'. ---> System.InvalidOperationException: Cannot serialize member
Please suggest me solution ASAP
Thanking you,
|
|
|
|
|
|
You are not allowed to serialize controls/Forms!
|
|
|
|
|
Dear Hristo,
Thanks for reply..
So how can I load the previous state of applicaton.?
I am using multiple workspace(Tabpages) and each of them contains More than one instance of any form...
i need to save this and load it on application startup..
Thanking you..
|
|
|
|
|
Just define abstract settings set of your application and load/save it from
app configuration file.Here there is some useful help for you.
modified on Friday, August 14, 2009 6:58 AM
|
|
|
|
|
Hi all !
When the file is closed, i just want to know the file path.
I am using as bellow :
ManagementEventWatcher mngWatch;
WqlEventQuery wqlEQ;
wqlEQ = new WqlEventQuery("SELECT * FROM Win32_ProcessStartTrace");
wqlEQ.EventClassName = "Win32_ProcessStartTrace";
mngWatch = new ManagementEventWatcher(wqlEQ);
mngWatch.EventArrived += new EventArrivedEventHandler(mngWatch_EventArrived);
mngWatch.Start();
from this event creator i can get an Exe path not a File path :
1) in the Process.MainModule name contains the Exe path of the notepad
rather i want the real path from where the file is opened
2) For more clarity if i open a file form D:\\test.txt then i when the file is closed, i want to get that FILE PATH
can some one help me how to do that.
thanks a lot
Regards
.....Jack
|
|
|
|
|
You cannot get that information. Each application would have to expose its own events or other notification service to tell you that a document it was editing was closed. There is no such standard, so noone does it.
|
|
|
|
|
Hi,
I am working on a windows application involving MDI forms and child forms.
The problem here is when I click an item in the menu bar I am displaying a child form. the child form should be in such a way that it is displayed inside the MDI form and should not be like popup box.I have done this as shown below.
Childfrm.TopLevel=False;
this.Panel1.Controls.Add(Childfrm);
Childfrm.show();
it's working well but the controlbox with title bar is being displayed seperately in maximised mode.I want the control box beside MDI form menu and child form title beside mdi form title. A very good example of this functionality is Edit plus.
I request any one who worked on this type of requirement to help me in solving this problem
Thanks in advance
|
|
|
|
|
Try setting the IsMdiChild property of Childfrm to true, setting this.IsMdiContainer to true, and setting Childfrm.MdiParent to this
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Hi thanks for ur reply. but it's not not working.
The code is given below.
//childform.IsMdiChild = true;
childform.MdiParent = this;
childform.TopLevel = false;
splitContainer1.Panel2.Controls.Add(childform);
childform.Show();
the first line is giving an error saying "Property or indexer 'System.Windows.Forms.Form.IsMdiChild' cannot be assigned to -- it is read only".
|
|
|
|
|
If TopLevel is false, the form can no longer be an MdiChild.
|
|
|
|
|
but i need it since I should show the child window within the mdi form.It should not look like a popup window.
thanks and regards
|
|
|
|
|
Well, you're going to have to change your design. An MdiParent form cannot be an MdiChild to another MdiParent.
About the best you're going to get would be to write code that handles the Move and Resize events of the child form you want and contrain it to the boundries of the MdiParent's MdiClient area, or an MdiChild form's boundries. No, I don't have sample code because I've never needed to to anything like that.
|
|
|
|
|
Hi all!
I'm can't find a way to go through all the nodes in a treeNode tree.
I found some examples online but they don't do the job:
foreach (TreeNode myNode in myTreeView.Nodes[0].Nodes)
{
} the myTreeView.Nodes[0].Nodes has only one node and not all of the nodes in the treeNode tree
so does any one has a solution?
|
|
|
|
|
for (int get = 0; get < treeTable.Nodes.Count; get++)
{
TreeNode tn = treeTable.Nodes[get];
foreach (TreeNode tnp in tn.Nodes)
{
}
}
|
|
|
|
|
|
You must get it recursively :
List<TreeNode> allTreeNodes = new List<TreeNode>();
private void CrawlChildNodes(TreeNodeCollection nodes)
{
foreach(TreeNode node in nodes)
{
allTreeNodes.Add(node);
CrawlChildNodes(node.Nodes);
}
}
private void Form1_Load(object sender, EventArgs e)
{
CrawlChildNodes(treeView.Nodes);
}
|
|
|
|
|
I have sql (sql server 2005) table which is having StartDate and EndDate datetime columns.
StartDate value inserting as 2009-08-11 00:00:00.000,
EndDate value inserting as 2009-08-11 23:59:00.000 (End of the day
This DB Server is located at london.
in my winforms(2.0) appliction i have typed dataset, is having same table schema.
Typeddatasset StartDate and EndDate DateTimeMode property set to UnspecifiedLocal.
i am populating this dataset with SP. SP is functioning properly.
returned data i am binding to DataGridView. when its biinding to datagridview,
StartDate is showing as '8/11/2009 4:30 AM' instead of '8/11/2009 12:00 AM' and
EndDate is showing as '8/12/2009 4:29 AM' instead of '8/11/2009 11:59 PM'
it seems problem is with databinding to dataset.
any sounds?
Ramana
|
|
|
|
|
Please do not attempt to bump your posts. Very rude!!
It is only 5 hours since your previous post. Have a little patience!!!
Whilst your problem is obviously urgent to you, we give our time on a voluntary basis. Therefore your need is greater than ours and if your need is so great I suggest thet you get your Credit Card out and visit rentacoder.com.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
ive got this code, and it works for my old app, but for this one it doesnt work :S
it just repeats the same process with the first item from the listview.
i want it to run through each of them.
and dont worry, i want it to be continuous.
please help :S
while (0 == 0)
{
int iCount = lvAccounts.Items.Count;
string inputURL = textBox1.Text;
inputURL = inputURL.Replace("http://", null);
ListViewItem[] accUserPass = new ListViewItem[iCount];
lvAccounts.Items.CopyTo(accUserPass, 0);
for (int i = 0; i < accUserPass.Length; i++)
{
foreach (ListViewItem item in lvAccounts.Items)
{
{
ListViewItem lvi = new ListViewItem();
ListViewItem.ListViewSubItem lvsi = new ListViewItem.ListViewSubItem();
try
{
WebClient dwnload = new WebClient();
byte[] myData = dwnload.DownloadData("http://" + accUserPass[i].Text + ":" + accUserPass[i].SubItems[1].Text + "@" + inputURL);
MessageBox.Show("http://" + accUserPass[i].Text + ":" + accUserPass[i].SubItems[1].Text + "@" + inputURL);
accUserPass[i].SubItems[2].Text = "Downloaded";
int amountdownloaded = Convert.ToInt32(label2.Text);
amountdownloaded = amountdownloaded + 1;
label2.Text = Convert.ToString(amountdownloaded);
}
catch (Exception)
{
accUserPass[i].SubItems[2].Text = "Failed";
}
}
}
}
}
what i want to do is download the same data, but use a different user:pass combination each time.
like
say i have listview like this:
User|Pass
User2|Pass2
i want to download file 'x' with the user pass in front
so with that listview i want to initiate a download of
User:Pass@x
User2:Pass2@x
but with what i have, i just get the User:Pass combination twice
i dont know why
|
|
|
|
|
You never actually use item, you know the items in the listview.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi;
i need to create an invoice (using vs2008) with a certain template i have on paper! will i be able to draw such a template (which is a table) using the word 2007 template applications and print it with some specific data entered at runtime? if it's possible, i need a walkthrough or sample for it and i've never developed this kind of application before so i need a precise document to follow. can anyone help? i really appreciate your answers...
--- Thanks
|
|
|
|
|
Isn't that just a good old fashioned mail merge?
|
|
|
|
|
i don't think so... the application at runtime should open a windows form and the user fills it at runtime and those entries will be inserted in the right cells of the ms word table (the template). as i said earlier, it's an invoice, but a big one! i've searched msdn but didn't find a sample i could use. can you guide me please?
--- Thanks
|
|
|
|