|
Hello all and let me explain my problem briefly in Windows Forms application.
If any of you read Julia Lerman`s book, i am basicly implementing the techniques that are explained there but one thing i couldn`t solve. To make it simple i have two tables with one to many relationship, like customer and address. I add the customer to the datasource and change the address navigation property to combobox.
I drag name, surname and adress to the Forms. This is how i do databinding
CustomerEntities context = new CustomerEntities();
List<adress> myadresses = context.addresses.ToList();
CustomerBindingSource.DataSource = context.customers.Execute(System.Data.Objects.MergeOption.AppendOnly);
AddressBindingSource.DataSource = myaddresses;
Now as the book says i set the datasource of the addreess combobox to AddressBindingSource in UI then set displaymember, value and selectedItem.
Everything works fine except that display member of the combobox doesn`t display porperly. It diplays as MyAppName.Address, meaning object itself..What am i missing please help me
|
|
|
|
|
Not sure I fully understood your needs. But try to override the ToString() method in order to select what's you want to display.
|
|
|
|
|
Thanks, i override the tostring method of the entity object to get the work done..When i use listbox nothing is needed to display correctly but with texbox this is needed i guess, thanks again
|
|
|
|
|
I have one application that we lost the source code to that I'm rewriting and another app I'm writing to help a business partner that I started yesterday.
I created a class project, removed the Class1 library, then added the Linq to Sql class type.
So far so good.
I added my tables and queries and rebuilt the application to start coding.
But when I start my normal process using (MasterContext context = new MasterContext()){} I keep getting the error that the context cannot be converted to IDisposable. WTF???!!!!
I've done everything I can think of but I keep getting this error. Also if I get rid of the using a write a select, the variable used in the from statement refuses to expand. Now I know that is usually a sign that I've screwed something up, but I cannot see what it could possibly be.
Any input would be greatly appreciated.
Michael
|
|
|
|
|
Does MasterContext implement IDisposable? If not you can't have it in a using
|
|
|
|
|
You must not know anything about Linq to Sql. MasterContext in a Linq to Sql class inherits DataContext which implements IDisposable. Also the documentation for Linq to Sql has almost the first line stating you should always use using() when creating a DataContext.
|
|
|
|
|
You're right, I don't know anything about Linq to SQL
|
|
|
|
|
System.Data.Linq.DataContext implements IDisposable , so MasterContext will too if it subclasses System.Data.Linq.DataContext . Check your inheritance hierarchy (not forgetting partial class files). It is also possible that something has gone wrong in auto-generation, if all else fails, I suggest is a restart (which fixes a surprising number of the odder problems).Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
That was the 'trick'. Everything that was 'broken' last night works today.
|
|
|
|
|
My application behaves unpredictably as I turn on the 'Group similar taskbar buttons' option in the Taskbar properties.
Strangely, the problem occurs only on some computers.
It is as follows:
I enable the Group similar taskbar buttons option in the Taskbar properties. As the taskbar buttons begin to get too small Windows automatically groups buttons so that all of the open buttons from the application are grouped into one taskbar button. This works fine.
The icon of the groupped button is Application's default resource icon which is also OK.
The problem is that the caption of the groupped button is set to the AssemblyName not the AssemblyTitle defined in the AssemblyInfo.cs file.
As I mentioned this problem occurs only under some conditions. I can not determine them.
For example the feature works fine as I run the application from local disk while it does not work as I run the application from network disk (same machine, same application).
Best regards,
David
|
|
|
|
|
I doubt this will really help you much...but are you aware of the fact that .NET applications running from a network share are treated as security risks? Maybe that ties into your issue somehow.
|
|
|
|
|
Hi,
I'm writing a UserControl that has similar functionality to the ListView but I'm writing it from scratch, it has columns and rows of type List<t>;
Everything is generally fine with the project its moving along except when I add items to columns or rows at design time, the IDE seems to be doing something odd when generating code in InitializeComponent().
For instance;
private void InitializeComponent()<br />
{<br />
BigView.Column column1 = new BigView.Column();<br />
this.bigViewer1 = new BigView.BigViewer();<br />
column1.Value = "Key";<br />
column1.Width = 253;<br />
new BigView.ColList().Add(column1);<br />
}
Every time I re-compile the project the columns are not reloaded in the designer, because the code above never really assosciates the column with my user control. I've tried lots of combination of attributes but nothing solves my problem.
This is what I'd expect the code should look like;
private void InitializeComponent()<br />
{<br />
BigView.Column column1 = new BigView.Column();<br />
this.bigViewer1 = new BigView.BigViewer();<br />
column1.Value = "Key";<br />
column1.Width = 253;<br />
this.bigViewer1.Columns.Add(column1);<br />
}
Does anyone know why the designer would do this? Why it creates a column but never adds it to my Columns property?
The columns property is a List<column>. The same thing happens with my rows property which is a List<row>.
|
|
|
|
|
I've solved this. I tried defining several attributes for the property and built the project but nothing seemed to change. After reading this article on [MSDN], section 'Generation of Nested Objects'; "mark a property with DesignerSerializationVisiblity.Content to indicate the code generator should "walk in" to this property and generate code for it" I had set this a while ago but found out I had to re-start visual studio for the changes to take effect?? not sure why I need to restart VS tho, but once I did it worked.
Does anyone know why I have to re-start VS to see changes in the UserControl? I'd have thought a simple 'rebuild' would have refreshed the loaded dll.
|
|
|
|
|
Hi i'm using this
Private _databasefields As New List(Of VerticeBindingField)
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content), MergableProperty(True)> _
Public ReadOnly Property DatabaseFields() As List(Of VerticeBindingField)
Get
Return Me._databasefields
End Get
End Property
Speto!
|
|
|
|
|
This is probably a newbie question so bear with me as I am new to C#/OOL
I'm currently developing a client/server system where what I would like to happen is that the server reads the eventlog whenever the eventlog is updated, stores this info and then updates the console on the client with the new information. So far I've got the eventlog reading working ok but can't work out how to get the server to call a method on the client to update the client console.
I currently have a method on the client (displayInfo()) which if I run every 10 seconds does what I want but I would rather call this from the server as and when the eventlog is updated. I also currently have at least some Remoting functionality through a ClassLibrary as the client needs to read the data from the server.
Additionally - With regards to remoting is a communications channel a 2 way thing i.e once a channel is established can it be used to process data in both directions or can it only be used by a client to retrieve data from a server?
Thanks for your time
|
|
|
|
|
As the server will have no way of knowing what clients are available you will need some mechanism to register the clients with the server. However, depending on your usage and where the clients will reside it may be better to poll the server occasionally. Alternatively, the server could place information is a database which the clients access to display it. Again depending on several factors you may be able to use SQL Dependency to have the client refresh it's view. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: you will need some mechanism to register the clients with the server
That makes sense and makes it far less appealing so based on that I'll switch to periodic polling from the client as it really isn't worth the effort at this point
Thanks for your time
|
|
|
|
|
If clients and server are on the same network, you coluld use WCF with a Duplex Contract.
Otherwise, polling is still the best option.
|
|
|
|
|
Dear All,
I have a problem in performing a operation in an existing excel file containing some operation(take for example add of 2 numbers).
Get input and write in the particular field in excel and automate the operation and get the output and show it in front end..
Pl help me in succeeding in achieving this proj.
|
|
|
|
|
For a complete sample on how to use excel via C#, see here
To use formulas, see here[^].Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Iam Developing a Application where it contains two threads. Now i want to show a single ProgressBar for two different threads. Can any body giude me regarding this... Please
|
|
|
|
|
You must perform the UI update from the UI thread, otherwise an exception will be thrown. This guy has a nice article about threading and winforms:
http://www.yoda.arachsys.com/csharp/threads/winforms.shtml[^]
In WPF, the UI thread can be found on the Dispatcher object.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Hello,
i want to let a Silverlight-Application run in a WinForms Application (in the WebBrowser Control or the Silverlight-Control)
How can i make that they both can communicate with each other? I mean, how can my Silverlight Application invoke a method in my WinForms Application and the same in the other direction?
Many thanks
|
|
|
|
|
Your Winforms code would need to talk to the Javascript code that hosts the Silverlight code. This Javascript code will act as the bridge between your Winforms code and the Silverlight application.
If you are calling a Silverlight website via a web browser control, check the website documentation to see if they accept input parameters via their javascript code.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
If we write in the same way as above for the hashtable then we would not get the desired values.
Hashtable ss = new Hashtable();
ss["key1"] ="india";
ss["key2"] = "bharat";
foreach (object gg in ss)
{
Console.WriteLine("Key value is " + gg);
Console.Read();
}
Here we get System.Collections.DictionaryEntry and System.Collections.DictionaryEntry as output instead of the value pairs stored in the hashtable.
In this case we can help of DictinaryEntry object for iterating the hashtable.
foreach(DictionaryEntry gg in ss)
{
Console.WriteLine("Key and value are " + gg.Key + " " + gg.Value);
Console.Read();
}
A DictionaryEntry object is simply a container containing the Key and Value .
http://www.mindfiresolutions.com/How-To-Iterate-the-Hashtable-in-C-311.php[^]Cheers,
Eliza
|
|
|
|