|
Hey all
I have 2 tables on my C# window form, say: interests table is parented to persons table. How could I show all interests from interests table in a checked box list? In addition to that, I would also like to be able to show some checked boxes that show these particular checked boxes are the interests of a particular person, and will be able to change it's data by checking and uncheking the check-boxes listed.
Thanks a lot.
|
|
|
|
|
You should try reading the documentation. Most of what you need - especially binding the checked state to a boolean column - is discussed in the .NET Framework SDK.
As far as having a parent-child relation view, you need to do this manually. When an item is checked in the parent ("Persons") view (the Control - whatever it is - bound to the "Persons" table), then you either need to call DataTable.Select on the "Interests" table or filter the DataTable by either getting a DataView from DataTable.DefaultView or creating a new DataView over the table by instantiating a new DataView , passing the "Interests" table as an argument to the constructor. You can then use the DataView.RowFilter property to filter the rows. Bind the DataView - not the DataTable - the CheckedListBox control.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Ok.. I dun really get ur explanation. I didn't use databind function to show all
interests from the interest table in the CheckedListBox, instead I used array, selecting all interests and put the into row. In this case, my first problem is to solve how do I pre-select the check boxes dependeing on the interests value of a person from the table...
|
|
|
|
|
Hi,
My goal is an accounting/financial/POS software which is modular(modules can work standalone), SW can be accessed remotely / via internet for service/checking, is scaleable (1 or more users). I'm thinking of using Microsoft SQL Server 2000 Desktop Engine for the DB.
I'm very new to C# and would appreciate an answer to the question below as well as any pointers which would help me plan the architecture / technologies to use to achieve the goal.
Q: The first question popping up in my mind (showing lack of OS/server understanding) is - When/under which circumstances do I need to use a server version of Windows (the last design I worked in the C# course was a client/server chat program where the clients and server were all running on Windows 2k pro) ?
BR,Vjeko
Vjeko
|
|
|
|
|
vjeko wrote:
When/under which circumstances do I need to use a server version of Windows?
In the context of using SQL Server 2000 varients, IIRC, MSDE won't permit connections across a network, so the software that is accessing it must be on the same machine. However, MSDE will work on a non-server version of windows (along with SQL Server 2000 Developer Edition - but the licence for that restricts its use to developing software and it can't be used in a production environment). The other versions of SQL Server 2000 require a server machine.
MSDE is also restricted in the number of simultaneous requests. I think you can have as many connections, but if any more than 5 (I think) commands are sent, only 5 will be processed. I don't remember if the remaining requests get rejected or if they just get queued up.
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
MSDE does permit connections across a network. I have 6 offices of 20-odd users each using an application that has MSDE 2000, and there is no appreciable speed drop due to the throltling (this,of course, is due to careful database access architecture in the application)
|
|
|
|
|
Vince Pacella wrote:
MSDE does permit connections across a network
Do you have to do anything special to it? A couple of months back I was doing an install project for a desktop version of an application. During the process some times the install didn't work because of database problems (the application connected to the MSDE database, but the contents of the database weren't right) and I wasn't able to connect to the MSDE database accross the network. I eventually had to install a second named instance of SQL Server 2000 Developer edition onto the test machine in order to use the Query Analyser to see what was wrong with the database and that connected fine, once it was local.
Vince Pacella wrote:
I have 6 offices of 20-odd users each using an application
Is it a web application? IME, MSDE will connect to a Web Application if it is being served from the same machine as the database.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Colin Angus Mackay wrote:
Do you have to do anything special to it?
You need to read the documentation When you install MSDE run the following command:
setup sapwd=[your sa password] disablenetworkprotocols=0
You may need a dash or slash in front of those arguments. By default MSDE installed with network access diabled. So if you install with the proper argument you can have network access enabled.. or if it's post-install , one of the exe files in the SQL Server directory folder is the server network configuration program were you can turn on access by protocol.
Colin Angus Mackay wrote:
Is it a web application? IME, MSDE will connect to a Web Application if it is being served from the same machine as the database
No web/http/html involvement at all. This is a Windows Forms 1.1 application, as such, the network connections are being made directly to the db server from each client.
|
|
|
|
|
Vince Pacella wrote:
disablenetworkprotocols=0
I learned something new today!
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Colin Angus Mackay wrote:
I learned something new today!
Believe me, this is something I will never forget... the amount of time I wasted wondering why I couldn't connect to the server before I stumbled on that.
|
|
|
|
|
Colin Angus Mackay wrote:
I don't remember if the remaining requests get rejected or if they just get queued up.
Neither. They become progressively slower (probably there’s a Sleep(connections * 100) somewhere)...
Due to technical difficulties my previous signature, "I see dumb people" will be off until further notice. Too many people were thinking I was talking about them...
|
|
|
|
|
MSDE does allow network connections, but you need to run it as a network user or as a local user in which the username and password exist on each local machine accessing it.
And it's actually something like 10 concurrent connections, though MSDN often says 25 (the MSDE docs say 10). Who knows. As long as you open and close your connectoins as quickly as possible, you could probably supporta bout 20 users depending on the load.
Still, though, SQL Server 2000 running on a server OS is still a much better idea, especially when scalability is an issue.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Basically, if your going to have more than 10 simlutaneous connections to the server machine, you WILL need a server version of Windows.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
It's good the MSDE issue was brought up - I'll keep MSDE in the back of my mind since it is free/license free.
It's sometimes hard to get the question /details right via e-mail. After further consideration, I can point out authentication and number of simultaneous connections to be the areas bothering me:
Authentication
==============
In the C# course I took, we developed a "Chat" clinet/server application, where the PCs were in a domain - so there was a server there (although we installed /used the application only on the win2kpro machines). There I used something like:
tcpc.Connect(servername, port);/to connect to chat server.
(a)Was authentication in the "Chat" environment done via the domain server ?
(b)Will authentication also work in a peer-peer network ?
(c)Does anything special need to be set in win2kpro or win2kserver (if needed) and or .NET/C# to get authentication working ?
Number of simultaneous connections
-------------------------------------
OK, I'll take the "number of connections" limitation
(eg 10 for win2kpro) for granted / not needing to know/how why this comes about.
I would appreciate any further hints/pointers on platform/architecture/DBs for such an application . I have considered other options/alternatives eg server + thin clients, MySQL instead of MSDE, maybe using Win98 to keep down costs, but have insufficient experience to come to any conslusions regarding what is optimum from scaleability, cost etc..
BR,Vjeko
vjeko
|
|
|
|
|
Hi,
What do you mean by "modules can work standalone"? Do they still depend on the same db server? Or they will need separate databases or XML files, which should be replicated to a central database, which will be used for reporting?
Also, I would suggest reading Martin Fowler's "Patterns of Enterprise Application Architecture" which is definitely one the best books on application design I've ever seen.
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
Hello,
I want to use png-images with an alpha-channel in a toolbar. I have to put those images into an imagelist and that's the problem: The alpha-channel is lost! There are only pixels which are completely opaque or completely transparent.
I use the .NET Framwork 1.1 and C#
Is this a known bug? Will it be fixed? How can I use alpha-blended images in a toolbar?
|
|
|
|
|
BaShOr wrote:
Is this a known bug?
Or a feature that maybe doesn't exist?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
BaShOr wrote:
Is this a known bug?
AFAIK yes, I doesnt invalidate the background and hence the images tend to get darker. You can fix this by doing the drawing yourself.
top secret xacc-ide 0.0.1
|
|
|
|
|
The ImageList in Common Controls 6.0 (Windows XP and newer) supports alpha channels in the ImageList . In order to support the alpha channel, CC 6.0 must be present (which means it won't work on earlier platforms) and you must include an application manifest that redirects the common control bindings to 6.0 (the ImageList class in .NET encapsulates the ImageList common control; this is true of most controls and many other classes in the .NET FCL).
See my article, Windows XP Visual Styles for Windows Forms[^] for an example of the manifest you should include (you can include it as a separate file called MyApp.exe.manifest, though).
Otherwise, you'll have to draw the images yourself like leppie mentioned. If you store the images in a ImageList , the alpha channel, IIRC, is lost (it's screwed-up when it goes into the image list). I could be mistaken. This is a known problem and you could google for the problem, i.e. when the alpha channel is actually lost: before insertion into the ImageList or when drawn by the ImageList .
If I'm right, you'll need to just use a collection to store your image and draw them yourself. It's not hard, though. The Graphics class has an overloaded DrawImage method you can use.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I placed a .manifest-file in the directory of the .exe and all my controls now have the XP style.
The alpha channel seems to work, but there's again a problem: There's a blue "halo" around the image!
What can I do?
Here's a picture:
http://mitglied.lycos.de/fxlabs/terrain_ico.jpg
|
|
|
|
|
If you don't want your controls (those that support it) to have the visual themes applied, just set the FlatStyle property to something other than FlatStyle.System .
Are you sure the halo isn't in your original image? Also keep in mind that if your image originally had a background color that set in the ImageList.TransparentColor , the alpha blending won't affect the anti-aliased pixels, which is most likely what those are. Make sure that if you use an alpha channel for your images, you don't use a background color that would be masked. With anti-aliasing, it won't be masked appropriately.
Again, remember that the manifest only affects Windows XP and newer. Make sure you don't have any problems on older Windows OSes; otherwise, you'll have to draw the images yourself.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I set the FlatStyle property.
The image has no background color at all, it's transparent.
I've taken a screenshot from Photoshop:
http://mitglied.lycos.de/fxlabs/terrain_ps.jpg
|
|
|
|
|
I'm not really sure. I've never had that problem. You could try to google[^] for any similar problems.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Can anyone give me a project where those alpha-blended toolbar icons work?
It's very annoying that such a basic thing doesn't really work!
|
|
|
|
|