|
Dear helpers out there
1. how do I display data from database into a checkbox list?
2. how do I display a new data into that checkbox list (into its database as well), when I add the new data from a AddButton_click?
Thank You A Bunch !!
|
|
|
|
|
You set the DataSource property to a valid data source, like a DataSet or DataTable . If your data source implements IListSource (like a DataSet ), then you should set the DataMember to the name of the object (like the name of the DataTable you want to bind to).
Then, set the DataTextField and DataValueField to the names of the columns or properties (depending on whether you bind against a ADO.NET data source or a list of objects).
If you add a row to the CheckBoxList , make sure it gets added to the data source (like a DataSet ). If you want to add this to the database as well, you should either use a DataAdapter derivative (like a SqlDataAdapter for SQL Server) with the command properties set accordingly and call Update , passing the DataSet . You could also just add it manually to the database and to the DataSet , but then you have a synchronization problem (they might get out of sync).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear all
I have tried to open a tcplistener on a server and i have accept many connection and redirect every conncetion to a thread, for splitting sended data from every client but unfortunatlly i have get corrupted data which is merged from many senders from the network i could not split them so if anynody have an idea about this problem could send it to me
Thanks for help
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
Hi folks,
Having just discovered the delights of using IDisposable properly, I have a question concerning the disposal of collections of IDisposable objects.
The scenario is as follows:
I have a class implementing IDisposable. This class owns a collection of other objects that implement IDisposable.
So, when I dispose the main object, should I dispose the contents of the array as well?
Any advise, comments and/or opinions welcome.
PS: Sorry for any typos I suffering mild RSI (three days of furious coding)
Dr Herbie @ Autoscribe
Remember, half the people out there have below average IQs.
|
|
|
|
|
If the class "owns" the objects (e.g., private fields) then, yes, you should dispose them.
If the class is merely a container for the objects (e.g., a collection like ArrayList), then no, the class user is responsible for that.
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...
|
|
|
|
|
I'm not sure how to explain this.
E.G. on a Data Grid Control (Design Time) in the Property Window there is a Auto Format..., Property Builder... Link.
When Clicked on, a window opens up and you can change the properties in a Windows Form.
now my Question is How do I create the Same thing on a control of mine.
|
|
|
|
|
Implement your own designer class (like a ControlDesigner ) and override the Verbs property. Attribute your control or component with the Type of your designer using the DesignerAttribute class.
See the ComponentDesigner.Verbs property documentation in the .NET Framework SDK for more details. You should also read Enhancing Design-Time Support[^] in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
problem with using VNC hooking
--------------------------------------------------------------
i have got a vnchood.dll and its source code.
the vnchood.dll use a global hook to monitor the desktop's changed area. i want to implement it in my c# project. but i dont know how to use it.
after my study on the source code ,i draw a conclusion: the hook posts messages to its calling thread, and the thread handle the coming message and to do something.
in my c# project,i invoke peekMessage() to gain the message from the hook. but the message seems wrong for it is always an invalide massage.
here is my part code:
private void hookthread()
{
while(true)
{
if(PeekMessage( ref msg,IntPtr.Zero,0,0,1))
{
if ( msg.message == UPDATEMSG )
{
idle_skip = true;
Console.WriteLine("hwnd:"+msg.hwnd);
}
else if ( msg.message == MOUSEMSG )
{
idle_skip = true;
Console.WriteLine("hwnd:"+msg.hwnd);
}
else if ( msg.message == WNDMSG )
{
Console.WriteLine("hwnd:"+msg.hwnd);
}
else if ( msg.message == WM_QUIT )
{
break;
}
else if ( msg.message == WM_USER )
{
Console.WriteLine("hwnd:"+msg.hwnd);
}
else if ( msg.message == WM_USER+2 )
{
Console.WriteLine("hwnd:"+msg.hwnd);
}
else if ( msg.message == WM_USER+1 )
{
}
else
{
TranslateMessage(ref msg); <--- the Loop always be here
DispatchMessage(ref msg);
idle_skip = true;
}
}
else
{
dosomthing();
}
}
---------------------------------
can u give me a suggestion ? or other C# sample using VNC hooking ?
|
|
|
|
|
Are you saying that you're rewriting the vnchook.dll in C#?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
I am using System.Net.Sockets in my app. I took some example code from MSDN for connecting a socket to a listening server, and I put it in an Windows Control (I believe same as ActiveX)...
Unfortunately, the following exception is raised when I try to call: hostEntry = Dns.Resolve(server);
The actual code could be found at MSDN.
Exception:
---------------------------
---------------------------
Exception Object
Source:mscorlib
Message:Request for the permission of type System.Net.DnsPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
---------------------------
OK
---------------------------
Another important fact is that I am trying to access the control through an HTML page.
Help on this issue is greatly appreciated.
"Needless redundancy is the hobgoblin of software engineering." - Peter Darnell
|
|
|
|
|
Are you by any chance running your app from a link in a web browser?
|
|
|
|
|
Hello,
Yes, I attempt to run my ActiveX control through a web page (with the <object> html tag)...
Hope it gives any clues to the problem.
"Needless redundancy is the hobgoblin of software engineering." - Peter Darnell
|
|
|
|
|
You need to make sure you have a code group set up in the .NET Framework Configuration (the code access security groups) for your control. You should use Site or Url evidence (host evidence) that matches the site or url from where your control runs (the hosting page URL isn't a factory - only the URL of the control). You should make sure that the DnsPermission is granted, or just cop-out and grant that code group FullTrust permissions.
.NET Code Access Security (CAS) is an important part of the .NET Framework. It's a much better sandbox than what you find in Java, and many, many times better than what's available for ActiveX. For a good article on .NET CAS, see Understanding .NET Code Access Security[^].
For more information, also see an old article of mine describing the entire process of hosting .NET controls in Internet Explorer, User Controls for Windows and the Web[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have created a smalll prototype like Ms visio. In my program i can add controls(rectangle, ellipse,..) to the panel and move them with mouse. But the problem is connecting them with lines so that the objects and lines should move together. Can anybody help me...
samitha
|
|
|
|
|
You could traverse your "control"-collection/array/etc and use the center of each "control" as the start/end-point of your line?
R.a.m
|
|
|
|
|
A common approach is to define a base class from which all shapes derive. You would define a property on this class that is either a collection or array (which is actually a static collection and list) that stores points. If you want, you could define this property as virtual and provide default connection points. If you declare it as abstract, then every derivative must override it. For any classes where you want to return a custom list of connection points, override the property (assuming it's optionally using a virtual property) and return coordinates of connection points.
Then, these connection point classes that you store maintain a list of other controls' connection points (which should have a member that returns the control they're a connection point for). When painting the container/surface, you draw a line between each connection point that is related to another. This is the reason you define a base class - so you can refer to every shape through it's abstract base class. This is polymorphism.
If you search CodeProject, you should find a couple examples, IIRC.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I defined a class. Now I want to define an array of classes. I don't know the size of the array. How do I define it then??
Karteek
|
|
|
|
|
Use an ArrayList , which will expand automatically as you add new objects.
Charlie
if(!curlies){ return; }
|
|
|
|
|
1. Array of class if you know the size.
using System;
namespace ClsArray
{
class Cls
{
public string Name;
public Cls(){}
public Cls(string name){this.Name=name;}
public static void Main()
{
Cls[] obj=new Cls[2];
obj[0]=new Cls("myname");
obj[1]=new Cls("yourname");
for(int i=0; i
|
|
|
|
|
You could put it all in an Arraylist if you're not concerned about
wether it should be strong-typed or not.
As an alternate option, you could make your own MyClassNamehereCollection, ie. dervice a class from System.Collections.CollectionBase
R.a.m
|
|
|
|
|
hai there,
which class in C# that will help me out for doing the process like
- Registry Scanning
- Hard Drive Scanning
- Memory process scanning
Sreejith S S Nair
|
|
|
|
|
|
I have a small annotation.
If you accidentially post an unready question, please use the Modify link on the lower right side of your posting instead of adding a new one.
I think you've done this a couple of times. If I'm wrong, I apologize for bothering you.
|
|
|
|
|
i noticed some portion of for..loop is missing. i use modify link to update that. but the funny thing is again and again the little portion of for..loop is not comming in board after submition.
i don't know why ? and thanks for your annotation
Sreejith S S Nair
|
|
|
|
|
if you have something like
for(int i = 0; i<Count; i++)
{
}
You have to remember to replace the < with < because the browser will assume that is the beginning of a tag and it won't be displayed.
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
|
|
|
|