|
I'm having an issue with the changes made to combobox selections being pushed back to a datatable. Hopefully I'll be able to explain things enough to at least get some help.
I have two comboboxes on a form. Each has its dataSource set to a pre-populated table in a dataset. Upon selection of a value in the first one, I change the DataTable.DefaultView.RowFilter on the second combobox's source table to filter the table and only display relevant selctions.
I also have a table which is meant to save the values selected in those two comboboxes. I declare a BindingSource, and set its dataSource to a third table in the dataset. I DataBind the comboboxes' SelectedValue property to the appropriate columns in the 3rd datatable.
Here's my issue.
Upon selecting a value in the first combobox, and then hitting the button that calls .EndEdit on the binding source, only the first combobox's value is moved back into the datatable, and the new second combobox's value is not.
I can select a value in the first, and then re-select the new filtered value, and that will result in a proper binding back to the datatable.
I'm looking for assistance on how to tell the bindingsource to process the new filtered value in the second combobox, since the user has not actually changed the value itself.
Any suggestions?
|
|
|
|
|
Can you publish your code snippet.
That will help in better understanding of your problem .
|
|
|
|
|
prior to the form being shown, these two are called in this order, assume everything not declared is declared before.
<code>
public void LoadForm()
{
PlayerSource = new BindingSource();
//assign to prepopulated table
PlayerSource.DataSource = myClient.PlayerList;
TeamSource = new TeamSource();
//same deal
TeamSource.DataSource = myClient.TeamList;
//assigning of Player info to labels through databinding
//databind player combobox
uxcbPlayer.ValueMember = "PlayerID";
uxcbPlayer.DisplayMember = "PlayerFullName";
uxcbPlayer.DataSource = PlayerSource;
//databind team combobox
uxcbTeam.ValueMember = "TeamID";
uxcbTeam.DisplayMember = "TeamFullName";
uxcbTeam.DataSource = TeamSource;
}
public void LoadData()
{
CurrentPlayerSource = new BindingSource();
CurrentPlayerSource.DataSource = myClient.CurrentPlayer;
uxcbTeam.DataBindings.Add("SelectedValue", TeamSource, "Team", false, DataSourceUpdateMode.OnValidation, "");
uxcbPlayer.DataBindings.Add("SelectedValue", TeamSource, "PlayerName", false, DataSourceUpdateMode.OnValidation, "");
}
</code>
In the Team.SelectedValueChanged event I call this funciton:
<code>
public void FilterTeam ()
{
if (uxcbTeam.SelectedValue != null)
{
if (PlayerSource != null)
{
PlayerSource.Filter = "Team = '" + uxcbTeam.Text + "'";
//uxcbBuilding.SelectedIndex = -1;
//reset cbBuilding Selected Index
}
}
}
</code>
Upon needing to save, I call CurrentPlayerSource.EndEdit(), and then deal with the data. The problem is that upon .EndEdit, the new value of the Player dropdown is not committed back to the database. Say if team A and Player A2 are selected initially, and the team is changed to team C, players C1-Cwhatever populate the second dropdown, C1 is shown initially, but on EndEdit, A2's value is put back in the datatable. If the user opens the player dropdown, and then selected the programatically-selected C1, then upon .EndEdit(), C1 is sent back, but I'm looking for a way to somehow "catch" the change on the second set and have the databindingsource (in this case, CurrentPlayerSource) catch the change.
|
|
|
|
|
Hi,
I am trying to build an n-tier architecture for my project.
At present this is what I have:
There is one Solutioin which contains the following:
1) The client (WinForms) project has a reference to the BusinessLayer project.
2) BusinessLayer project has a reference to the WebService
3) WebService has a reference to the DataLayer project.
4) DataLayer project calls the sql server.
Would you say if I call the webservice direct from the client (WinForms) then this is a good idea or do you think the above 4 steps construct a good design?
Thanks
|
|
|
|
|
I'm in the process of architecting (and building) a similar sort of application.
However, I see my WinForms client (and in the future a web or other type of client) simply as a presentation and controller layer - i.e. something that displays information to the end user and forwards the end user's intentions to the rest of the application. IOW, my WinForms client is extremely dumb and thin. (Unlike me - I'm just dumb).
My webservice interacts with a business layer which in turn interacts with a data layer. The data layer serializes the data portion of several business objects that eventually find their way across the wire to the client (for display purposes).
I've built an automated test harness at each layer - viz: object persistence, business logic, and web service. When I finally get around to building the GUI I'll farm out the visual testing to another party.
Hope this helps.
/ravi
|
|
|
|
|
Hi,
I think that the n-tier architecture is appropriate. But if you call the webservice from the client tier, the n-tier model loses his sense... Because I supose that client tier contains only forms with events and this events call in few lines single methods from the below tier without applying bussines rules...
It's only my point of view...
|
|
|
|
|
Right now I am doing a Project with the following Layout:
- A Database-Layer doing O/R mapping to the Database(es).
- A Business-Logic doing calculations of the data from the Database(es)
- A Webservice-Layer sending this computed data to and from the Client
- A Client (mixed C++/C#) formatting the data for display and collecting the users input. The Client then calls the relevant Webservices to make the user-interactions happen.
The goal is to have a system that ist capable to run on one (decent) PC of being separated into front- and backend, where the backend is a big machine and the client may be an older notebook or something..
The Client calls the Webservices directly, to get fresh data or to get calculations done.
I hope this helps you to decide for one architecture or another.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
I'm looking for examples of creating instances using a late binding strategy. What I'd like to do is to define something in my App.config file like:
<add key="foo" value="My.best.Type, My.best, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
I could parse the value at the commas but it seems to me that Microsoft must have provided a more elegant solution. I just can't seem to find it.
TGS
|
|
|
|
|
Tom.sikes@eds.com wrote: I'm looking for examples of creating instances using a late binding strategy. What I'd like to do is to define something in my App.config file like:
I could parse the value at the commas but it seems to me that Microsoft must have provided a more elegant solution. I just can't seem to find it.
Cool - the invisible config section;P
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thats what I get for not using preview
Here is the invisible code:
<add key="foo" value="My.best.type, My.best, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
|
|
|
|
|
You're on the right lines here. What your code needs to do is:
public object GetInstance()
{
return (object)Activator.CreateInstance(Type.GetType(ConfigurationSettings.AppSettings["foo"]);
}
Obviously, you would need to make this a lot more robust (exception handling, etc) and you would probably want to use a defined interface in place of object, but this should give you the general idea.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi Guys
I heard my teacher talk about that it was possible to acces C++ code and import it into C# using .Net... Is there maybe someone how has done this before and can provide me with som samples. I'm thinking about accesing a C++ -library containing FFT (Fast Fourier) for my signal processing project, which is being programmed in C#... is this possible? seems difficult to find any good FFT implementation in pure C#...
Thanks a lot
AL
|
|
|
|
|
See this[^] article.
/ravi
|
|
|
|
|
hi
how can i create a fade in/out menu for my asp.net website ?
i am using c#.
thanks.
|
|
|
|
|
This[^] link may help.
/ravi
|
|
|
|
|
thanks Ravi Bhavnani
Can you say me how to use it ?
thanks .
|
|
|
|
|
You'll need to select an appropriate menu and follow the directions at that page.
/ravi
|
|
|
|
|
I need to stretch a character width horizontally in rich text box - Visual c# - framework 2.0.
Thanks in Advance
Charles Pratheepan
|
|
|
|
|
Do you mean that you have some random text and that you have to adjust the fontsize to make the text fit the width of a rich textbox?
-Larantz-
|
|
|
|
|
Yes .... I want to increase the font width alone.
|
|
|
|
|
Uhm. Not sure if that's possible. Setting width alone would end up in unreadable characters.
You would have to set the full font size for it to give any meaning I believe.
You can solve that through a recursive method or other form of loop where you use Graphics MeasureString method with a userdefined font and the width of your textbox. For each iteration, if width of the size returned by MeasureString is still larger then your textboxs width, reduce fontsize by 0.5 for instance.
-Larantz-
|
|
|
|
|
There is a way to achive the same in Framework 3.0 ....
Some stretch property is available for fonts...
Is there any equivalent method or property available in framework 2.0?
|
|
|
|
|
Hello,
If I have a string: xxxxxxImg3.xxx, where x can be anything, and number changes.
How can I specify it using Regex expression?
Thanks.
|
|
|
|
|
Which part of the string do you want to get?
This will filter the Img{digit} part:
Img\d+\.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I want to get the Img# part, and I wanted to group the number part, so later I can get a handle on it. I tried to use: (?<imagenumber>[1-9]*), but that did not work.
Thank you.
|
|
|
|