|
uraaa! I got it working and listed on a textbox. If i listed only the titles of the books in the listbox. when i select an item an click an "ok button". How can a retrieve the matching publisher?
Thanks a lot again
Donkaiser
|
|
|
|
|
Practically every control in Windows Forms has a handy Tag property that you can assign what ever you want to.
So you can assign those book XmlElement items that you extracted earlier to each one of their corresponding list items.
And then when you click an ok button, check the listbox.SelectedItem.Tag property -- that'll be whatever you assigned to the tag.
Edit: sorry, that's ListView I'm thinking of.
ListBox lets you assign any type of object, so you can make a custom class and override the ToString method to have it show the right text in the list box.
So make a class like this:
class Book
{
public Book(string name, string publisher)
{
this.name = name;
this.publisher = publisher;
}
string name, publisher;
public string Publisher
{
get { return publisher; }
}
public string Name
{
get { return name; }
}
public override string ToString()
{
//Just show the name
return name;
}
}
When you add an item to the list box, do something like this:
listBox.Add(new Book(element["Name"], element["Publisher"]);
When you want to get the publisher for the selected book, do this:
publisher = (listBox.SelectedItem as Book).Publisher;
-- modified at 19:59 Friday 19th May, 2006
|
|
|
|
|
I am writing some code in C# and have the need to call a third party java api. I am attempting to write a C++ dll that can be called from
C# -> C++ -> Java -> Java API.
Everytime I make a call to JNI_CreateJavaVM from Java I get a JNI_ERR or -1
I do have a java class file in the same directory.
I also have the location of jvm.dll in the system path variable.
Also, if I run the C++ code as a stand-alone executable instead of a DLL it works.
Any Help would be appreciated.
Thanks
JNIEnv *env;
JavaVM *jvm;
jint res;
JavaVMInitArgs vm_args;
avaVMOption options[1];
options[0].optionString = "-Djava.class.path=C: \\CsstProductInterface.jar";
vm_args.version = JNI_VERSION_1_2;
vm_args.options = options;
vm_args.nOptions = 1;
vm_args.ignoreUnrecognized = JNI_TRUE;
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
if(res < 0)
{
AddToLog("UNABLE to start JVM\n\n");
}
Pat
|
|
|
|
|
I have a piece of code in which collection is assigned to dropdown list's data source property for binding data. When multiple clients access the site simultaniously the following exception was being thrown:"Collection was modified; Enumeration Operation may not execute". Any idea about y this is happening and how to get this code work???
|
|
|
|
|
Is not allowed to modify any item of a collection in any way while you're inside the foreach loop on that collection.
You may try to lock the piece of code, something like the following
lock(this) {
...
}
paco
|
|
|
|
|
Thank you carlopagliei for the reply; but i am not using the foreach statement. I have a code like
ddlTest.DataSource= TestCollection;
ddlTest.DataBind();
Otherthan populating the collection from database, i am not manipulating the collection.
|
|
|
|
|
It was only an example. You don't use foreach but probably the problem is that while DataBind() method enumerates over the TestCollection another piece of code (maybe the same but from another thread) is doing the same. So try to lock the code that acess TestCollection before use it:
lock (TestCollection) {
ddlTest.DataSource= TestCollection;
ddlTest.DataBind();
}
paco
|
|
|
|
|
Hi.
when we create a class, and in code type 'ClassName.', some methods and properties appear, and on an object of that class there is another properties and methods.
first : we don't write them for that class, these properties and methods come from where?
second : for class and object these are difference, why?(Is it for static methods and properties?)
Best wishes
|
|
|
|
|
mehrdadc48 wrote: first : we don't write them for that class, these properties and methods come from where?
Are you referring to methods such as ToString()? They would be inherited from the base class (in this case, System.Object).
mehrdadc48 wrote: second : for class and object these are difference, why?(Is it for static methods and properties?)
You are correct. You cannot call static methods using an object instance.
Cheers,
Vikram.
I don't know and you don't either.
Militant Agnostic
|
|
|
|
|
Typing "Classname." invokes intellisense which lists the properties and methods of that class or object so as to ease the work of a prorgammer so he/she does not have to remember all the properties and methods of the Dot Net Framework. There are many classes built into the Dot Net Framework, many of which wrap commonly used functionality that already exists in Windows. In summary, these classes and intellisense are there to make a programmer more productive and are part of the Dot Net Framework installed on your computer.
As for the difference between the methods displayed by Classes and Objects; Yes you are right that for Classes, only static methods are displayed unlike Objects.
|
|
|
|
|
Hi. I have a rss, and I want to remove the items that its pubDate are lower than a DateTime. The problem is that I can't use the function to compare date in XPath because the pubDate use the RFC-822 format and the function in XML/XSD/XSLT, use ISO-8601 format. So I have to use an external function to remove the nodes like this:
public static XmlDocument XMLFilter(XmlDocument doc, DateTime aDate)
XPathNavigator nav = doc.CreateNavigator();
DateTime nodeDate;
foreach (XPathNavigator node in nav.Select("rss/channel/item/pubDate")) {
nodeDate = DateTime.Parse(node.Value).ToLocalTime();
if (nodeDate.CompareTo(aDate.ToLocalTime()) < 0) {
node.DeleteSelf();
}
}
return doc;
}
But If I return the doc, the element are not removed. I want to remove that node (where I compare the condition node.DeleteSelf())
Thanks a lot !!!!!
|
|
|
|
|
Heyyy, I found the way !!! . Thanks anyway people !! May be this solution could help somebody, like me !!
public static XmlDocument XMLFilter(XmlDocument doc, DateTime aDate)
{
DateTime nodeDate;
XmlNode nodeChannel = doc.SelectSingleNode("rss/channel");
XmlNodeList pudDateNodeList = doc.SelectNodes("rss/channel/item/pubDate");
foreach (XmlNode node in pudDateNodeList){
nodeDate = DateTime.Parse(node.InnerText).ToLocalTime();
if (nodeDate.CompareTo(aDate.ToLocalTime()) < 0) {
nodoChannel.RemoveChild(node.ParentNode);
}
}
return documento;
}
|
|
|
|
|
Hi.
I use Flash player component in my project.
How can I close right click on Flashes that it plays.
It don't have click event.
Best wishes
|
|
|
|
|
Hi.
When take right click on solution name in solution explorer, a choice is 'build solution', and another is 'Rebuild solution'.
What is the difference between them ?
Best wishes
|
|
|
|
|
Build just works on modified files, Rebuild deletes all object files etc, and does everything. I think.
Regards,
Rob Philpott.
|
|
|
|
|
Exactly. Build only builds the projects that has files that has changed since last build. Rebuild makes a complete build of the entire solution.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: Build only builds the projects that has files that has changed
And one has to be careful with this. For example Visual Studio won't notice any changes made to resx files and won't build it until explicitely rebuild has been clicked.
|
|
|
|
|
Hi
How i can drow on web pleas give some exmple.
than'k
|
|
|
|
|
Be more specific, on web pages may be JS help.
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
If you want the user to be able to draw on a webpage and you save it, the only technologies I can think of which may let you do this are:
Applets (using Java)
and
Flash
Kind regards - Jakob
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Ok but i don't know how to insert some flash movie on my web please help me with that.
|
|
|
|
|
Hi,
I am working on a VoIP application. I retrieve voice streams from a MIC. Now I would like to apply an audio codec (G711 or G729) on these streams.
I don't know where to start ...
Has someone an idea ?
Thanks in advance
Guillaume
Guillaume
http://www.ece.fr/~gbonnet
|
|
|
|
|
I haven't worked on a project like this myself, so this might be a complete red herring - but I think the Windows Media Encoder SDK:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmencode/htm/aboutthewindowsmediaencodersdk.asp
should be helpful.
-- modified at 18:14 Tuesday 16th May, 2006
Here's a link specifically for us CSharpers:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmencode/htm/creatinganencoderapplication.asp
|
|
|
|
|
HI,
Thanks for that. I will have a look at it.
Bye
Guillaume
http://www.ece.fr/~gbonnet
|
|
|
|
|
The link you sent is very good if you want to apply a codec that you "create" on your own. Thanks.
Although I would like to use an standard codec such as g711. So I have to look at something else.
I found that SUN release the code public :
Cpp : http://www.koders.com/cpp/fid45CC4E8F93239756E0CD455477269712A825C1E9.aspx
C: http://www.koders.com/c/fidCB98985908407980C619193ED46BC31B0535D651.aspx?s=g711.c
So I should be able to do something.
Regards
Guillaume
Guillaume
http://www.ece.fr/~gbonnet
|
|
|
|