|
You can set the ColumnMapping property on each column to MappingType.Attribute .
Without nipples, breasts would be pointless.
|
|
|
|
|
:-DGreat!
That was the best and eazyest solution.
To solve it with XMLSchema created alot of overhead and
puluted the xml with alot of xmlns-information...
|
|
|
|
|
Hi,
I have two lists (A and B).I want to add some items from A to B and remove the items from A. I've used two ListBoxes for this situation.
I want to display Name of items and for adding and removing I have to know ID of each item. So I use ListBox.DataSource to fill items. First I define a class:
<br />
public class USState<br />
{<br />
private string myShortName ;<br />
private string myLongName ;<br />
<br />
public USState(string strLongName, string strShortName)<br />
{<br />
<br />
this.myShortName = strShortName;<br />
this.myLongName = strLongName;<br />
}<br />
<br />
public string ShortName<br />
{<br />
get<br />
{<br />
return myShortName;<br />
}<br />
}<br />
<br />
public string LongName<br />
{<br />
<br />
get<br />
{<br />
return myLongName ;<br />
}<br />
}<br />
<br />
public override string ToString()<br />
{<br />
return this.ShortName + " - " + this.LongName;<br />
}<br />
}<br />
Then for filling list items :
<br />
ArrayList USStatesA = new ArrayList() ;<br />
ArrayList USStatesB = new ArrayList() ;<br />
USStatesA.Add(new USState("Alabama", "AL"));<br />
USStatesA.Add(new USState("Washington", "WA")) ; <br />
USStatesA.Add(new USState("West Virginia", "WV"));<br />
USStatesA.Add(new USState("Wisconsin", "WI")) ;<br />
USStatesB.Add(new USState("Wyoming", "WY"));<br />
<br />
ListBoxA.DisplayMember = "LongName" ;<br />
ListBoxA.ValueMember = "ShortName" ;<br />
ListBoxA.DataSource = USStatesA ;<br />
<br />
ListBoxB.DisplayMember = "LongName" ;<br />
ListBoxB.ValueMember = "ShortName" ;<br />
ListBoxB.DataSource = USStatesB ;<br />
Everything is OK by above codes. But the problem is: When I Remove an object from ListBoxA and then Add it to ListBoxB; no changes will be appear in ListBoxA.Items or ListBoxB.Items .
How can I update ListBox Items same as its DataSource updated?
regards,
Mehdi
|
|
|
|
|
One method that will work is to invoke the Refresh method of the Currencymanager objects involved, e.g. after you've moved an object from one ArrayList to the other:
CurrencyManager cm = BindingContext[USStatesA] as CurrencyManager;<br />
if (cm != null) cm.Refresh();<br />
cm = BindingContext[USStatesB] as CurrencyManager;<br />
if (cm != null) cm.Refresh();
A nicer method might be to wrap the ArrayLists (or derive from them) in an object of your own which implements the IBindingList interface. This allows an event to be raised when the list is changed, and I assume that the CurrencyManager traps this event and automatically updates the bound controls (but this is based only on my understanding of the documentation - I haven't tried it ).
Chris Jobson
|
|
|
|
|
Thanks Chris.
I think I didn't write the problem clearly. I tell you it again.
I write below method to remove an item from ListBoxA and add it to ListBoxB:
<br />
void TransferItem()<br />
{<br />
object SelectedObject = ListBoxA.SelectedItem;<br />
((ArrayList)ListBoxA.DataSource).Remove(SelectedObject);<br />
((ArrayList)ListBoxB.DataSource).Add(SelectedObject);<br />
}<br />
By this method the DataSource of ListBoxA and ListBoxB has been changed, but no changes will be appear in ListBoxA.Items and ListBoxB.Items .
I couldn't change the Items directly because of using DataSource for ListBoxes.
Can you help me please.
Mehdi
|
|
|
|
|
Mehdi,
If you add the code I gave, or the following modified version of it, at the end of the TransferItem method in your previous posting it should work:
CurrencyManager cm = BindingContext[ListBoxA.DataSource] as CurrencyManager;<br />
if (cm != null) cm.Refresh();<br />
cm = BindingContext[ListBoxB.DataSource] as CurrencyManager;<br />
if (cm != null) cm.Refresh();
Chris Jobson
|
|
|
|
|
Hi there,
Is it possible to add a ProgressBar control to a status bar or do you simply have to make the status bar panel owner drawn?
Thanks in advance
- monrobot13
|
|
|
|
|
Hi, I may be mistaken but I think that you cannot place controls into a StatusBar control in the designer. However, you can add any number of Controls to the StatusBar programatically through it's Controls property.
Hope this helps
Hey don't worry, I can handle it. I took something. I can see things no one else can see. Why are you dressed like that?
- Jack Burton
|
|
|
|
|
Thanks Chris! I'll give it a try.
// Edit
Gave it a try. It works...the problem is that is always inserts the progressbar as the very first item on the statusbar. I tried using the SetChildIndex method of the Controls collection but it had no effect. Any ideas?
- monrobot13
|
|
|
|
|
Try writing a StatusBarPanel derived class as described in http://www.dotnet247.com/247reference/msgs/20/102483.aspx[^]
Regards
Thomas
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
Here's another link: http://www.dotnet247.com/247reference/msgs/12/62892.aspx[^]
Regards
Thomas
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
What's the equivalent of the Win32 API GetLocaleInfo for .NET?
Thanks,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
I think the CultureInfo class (from System.Globalization) might be what you're looking for.
Chris Jobson
|
|
|
|
|
Yes, thanks, that's the one.
Do you know if there's a mapping of Win32 APIs to their equivalent namespace.class.methods in .NET. Something like that would help a lot of people like me who are porting apps from Win32/MFC to .NET.
For example, I just ran into another one. What's the equivalent for VK_DELETE? Well, I had to search for a few minutes before I discovered the System.Forms.Keys enumeration.
Thanks again,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Hi,
I need to insert a checkbox control into the column header of a DataGrid.
So, I display the checkbox on the left side of the HeaderText.
How can I do?
Thank's
|
|
|
|
|
I need to determine the amount of records in a database table without looping through the tables records one by one, that seem to be very slow over a 33kbps connections if you got 20,000 records???
Leon v Wyk
|
|
|
|
|
In order to find out the number of records in a database table "table", use the SQL Command:
Select count(*) from table
In general, try to get familiar with SQL and what it can do for you. It can do a LOT more than procedural code.
|
|
|
|
|
I thought you guys might be able to help.
I am still undecided about J#. Can anyone explain why the code snippet below would work in J++ but not in J#. The code compiles okay but it cant find the text file to read from. Instad, the exception I catch is J# filenotfoundexception. The text file is in the right directory. Anyways, appreciate any help.
public static String[] getIndonesianwordList(String file){
String IndonesianwordList[] = new String[9];
try{
BufferedReader in = new BufferedReader(new FileReader(file));
String s;
int i = 0;
while((s=in.readLine())!=null){
StringTokenizer tok = new StringTokenizer(
s,DELIMITERS);
while(tok.hasMoreTokens()) {
String nextWord = tok.nextToken();
System.out.println(nextWord);
IndonesianwordList[i] = nextWord;//wordList.add(nextWord);
i++;
}
}
}
catch(IOException e){
System.out.println(e);
System.out.println("error loading array");
}
return IndonesianwordList;
}
|
|
|
|
|
Just a guess, but maybe J# requires a fully qualified path name for FileReader (e.g., "C:\temp\foo.txt" rather than "foo.txt").
|
|
|
|
|
I am creating a small application that will goto a specific directory, display its contents, etc - basically the window where the dir contents is displayed should have the same functionality as a normal explorer window :
i.e.
Drag/Drop
Listing/Sorting functions
Double Click to open
I assumed that this would be fairly simple, but after some surfing around it seems that is not the case at all.
Does anybody have any experience of this?
|
|
|
|
|
Well after a few hours of looking around I have come up with a grand total of nothing.
So I have started to write my own, so far so good, but I have encountered a stumbling block - I cant find any code to open a file given its path.
For example, I am trying to open the following file :
C:\skunkworks\directoryviewer\test.txt
Does anybody have any info on achieving this?
I have been looking through this article :
http://www.codeproject.com/csharp/csdoesshell2.asp[^]
But it all seems to much to simply open a file in whatever the associated application.
|
|
|
|
|
I have found a solution to the file opening problem I mentioned above, just incase somebody is searching these forums for a similar answer this is the code I used :
<br />
FileInfo launchfi = new FileInfo(strDocumentPath);<br />
Process proDocument = new Process();<br />
proDocument.StartInfo.FileName = launchfi.FullName;<br />
proDocument.StartInfo.WorkingDirectory = launchfi.Directory.FullName;<br />
proDocument.StartInfo.UseShellExecute = true;<br />
try<br />
{<br />
proDocument.Start();<br />
}<br />
catch<br />
{<br />
MessageBox.Show("Unable to open selected document. If this problem persists please contact your Administrator.", "Document Open Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);<br />
}
|
|
|
|
|
Hi there
Basically whats the avantage of .NET over Visual studio 6.0.Many Ppl say that Common language Specification is the Advantage.
Do they mean that a code writtern in VB .NET can be used in C#?
If so we can very well write a dll in VB, that can be used in VC++.
Plz make me clear on this stuff .
Thanks in adv.
Srini
|
|
|
|
|
the difference is mainly
1) common class library across languages.
2) class/object reuse across languages.
you can't do this is vb/vc++ - you can provide a dll interface, but thats at a function level, not an object level.
of course you can get the same results with vb/vc++ and some clever programming, but the whole point is the M$ have done it for you.
its all about productivity.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Hello all
If anyone knows a good .NET spell checker component, please let me know.
Thanks
Smitha
It is better to be hated for what you are than to be loved for what you are not.
-- Andre Gide
|
|
|
|