|
Each control has a DataBindings collection. So you can do something like:
Binding bookBinding = this.txtBookingDate.DataBindings["Text"]
Amazingly enough you then have a Binding instance (bookBinding ) that has properties like DataSource , BindingMemberInfo and others that might be useful.
Hope that this helps.
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.”
|
|
|
|
|
I'm working on a utility that reads files and gets the 'words'. It's a sort of indexing project that I'm working on. I've got a lot of formats covered but there are a few formats - like pdf and doc - that I am having trouble with. So as I'm playing in C# I'll ask here.
Has anyone tried to mine the text from these formats and if so was it possible without an intermidary file? Ideally I would like to be able pass the file into a StreamReader derived class and read the text out of the other end.
Any idea guys and gals?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
|
From that one word, I have an article, a web-site and a solution
Thanks totally, you will be mentioned should this make it to an article; in 5-6 time...
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
You are welcome
|
|
|
|
|
To interact or read for a doc file (MSWORD) you would have to reference the microsoft PIA (primary interop assemblies) to interact with a word file, that includes reading and writing.
|
|
|
|
|
how to pass the data from form 1 going to form 2??
|
|
|
|
|
|
you can use public static global variable in first forms class (For example form1) and can access that data from next class by(form1.variablename).
Another way can be:
overload the constructor for form2 with paramater and create object of form2 with parameter from form1
|
|
|
|
|
dokhinahaoa wrote: you can use public static global variable in first forms class (For example form1) and can access that data from next class by(form1.variablename).
Never ever suggest that! It is very bad practice to do this: fro example what happens if you need two instances of form2 with different parameters? Rmember we get a lot of beginners reading this forum - we do not want them getting the idea that this is something you should do in the real world!
Either pass parameters via the second form constructor, or use events to pass / pick up the data.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi Guys,
Please could someone assist me...
I am trying to extract the text placed between i love puppies using regex.
I have html in a variable and i am trying to establish whether an anchor tag exists in this string that contains "i love puppies" or if need be "love puppies".
I have attempted to using this
MatchCollection mAnchor = Regex.Matches(originalStr, @"(<a[^>]*> ('text'[^<]*) </a>)*", RegexOptions.IgnoreCase);
but due to my lack of deeper understanding of regex...i have not been successful...
Thank you in advance,
Butch
|
|
|
|
|
Are "love puppies" a pseudonym? Never, mind I don't want to know...
Try Expresso [^]- examines and generates Regular expressions. I use it all the time for regex creation. It also has a small library which may help.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
We would need to see examples of the text you are trying to parse.
|
|
|
|
|
I am having a problem for the following case:
I have an xml file in the directory of the myproject.exe file of my project. as a result i m using relative path to open the xml file.
I am openig the file using the following code:
XmlTextReader xtr = new XmlTextReader("center.xml");
I have a open file dialog box in that project and i read a MSAccess file using that open file dialog box. But after reading the MSAccess file when I try to read the xml file with the same code then exception raised and shows could not find file "path of the MSAccessfile\center.xml"
So how can I get back to the directory whre the myproject.exe file located"
|
|
|
|
|
You can get the .exe filename from :
Process.MainModule.FileName
Then get the directory from your process .exe and set the directory to OpenFileDialog.InitialDirectory.
|
|
|
|
|
I have done the following code and it solved my problem.
try
{
Process p = Process.GetCurrentProcess();
String location = p.MainModule.FileName;
int start = location.IndexOf(Process.GetCurrentProcess().ProcessName.ToString());
location = location.Remove(start);
xml = location + "center.xml";
}
|
|
|
|
|
string directoryName = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
string xml = directoryName + @"\center.xml";
|
|
|
|
|
Further to the pevious answer, using relative paths isn't a great idea. If you know for sure where a file is then use the path. The file center.xml should probably be in the runnign directory and not the application directory. Though normally the same, they can be different. The best to use is System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I have the following code extract:
public arraylist myList = new arraylist();<br />
public struct myDBList<br />
{<br />
public string strKey;<br />
public string strName;<br />
public string strDataSetName;<br />
}
I loop thru a list of databases and add data from each to my list:
foreach (database db in dbList)<br />
{<br />
myDBList.strKey = db.Key.ToString();<br />
myDBList.strActual = db.Name.ToFriendlyString();<br />
myDBList.strDataSetName = db.Path.ToFriendlyString();<br />
myList.Add(myDBList);<br />
}
this arraylist is then passed to a 2nd form with:
Form myLogon = new Form();<br />
myLogon.passedList = myList;
In the 2nd form I have declared the same arraylist & struct and I want to loop thru the list and extract the data so I use:
ArrayList newList = new ArrayList();<br />
public struct myDBList<br />
{<br />
public string strKey;<br />
public string strName;<br />
public string strDataSetName;<br />
}<br />
string key;<br />
<br />
public arraylist passedList<br />
{<br />
get{ newList = value; }<br />
}
and in the code:
foreach( dbList db in newList)<br />
{<br />
key = db.strKey;<br />
.<br />
.<br />
}
While the code compiles, when I come to execute the foreach statement i get the error:
InvalidCastException was unhandled - specified cast is not valid
What am I doing wrong here ??
|
|
|
|
|
Just because the 2 declared structs have the same fields, it doesnt mean you can cast from one to the other.
Declare the struct once, in a project that both locations can access.
|
|
|
|
|
Thanks J4amieC.
If I'd noticed what the tags were telling me when I hovered over the foreach I'd have seen this for myself. I removed the declaration of the DBList in form 2 and qualified the DBList in the foreach with the form 1 instance and it all works !!
A case of not spotting the obvious.
|
|
|
|
|
Hi,
How to set a ID and Value to a node in tree view control. So the checked ID and Value can save in database
Thank you
YPKI
|
|
|
|
|
The TreeNode class has a Tag property that is an Object , since everything (practically) descends from Object , you can store anything there.
There is a reasonable example of doing this in the MSDN documentation for TreeNode.Tag .
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.”
|
|
|
|
|
Hi,
How to get the child node text of all the checked child node in a tree view control?
Thankyou,
YPKI
|
|
|
|
|
check it recursively.
if(node.Checked) {stringBuilder.Append(node.Text);}
|
|
|
|