|
Concerning the scroll thing, i've done similar things in my project.
Instead of using the AutoScroll ability, here's what i did :
* create a Control Inheriting from a Panel.
* add a scroll bar in it and some code to manage the SizeChanged event ( or just dock it on the right )
* add another panel ( which will be your client zone ) inside this first one.
* make it so that when any control except from your scrollbar and inner panel is added to your main control children, they in fact are attached to your inner panel.
then scrolling is just a matter of positionning the inner panel.Top
Inner panel needs to be resized every time a control is added/removed from it.
Every time the inner panel is resized, the ScrollBar maximum value is set.
You need a bit of coding to get it fully functionnal, but it's worth it imo... Autoscroll is barely useful since you can't scroll with code.
This worked great for me. I didn't want to use external API calls to manage my scrolling.
Hope this will help, though i'm not completely sure i understood your problem.
Etienne.
|
|
|
|
|
Hi Gangren!
I did exactly what you told me and it works great!
But I did encounter a problem when the control is resized (i.e. from normal to maximized), the control's Left property holds a negative value!
Why?!
|
|
|
|
|
Hi,
I'm not sure i understand the problem, maybe you could be a little more specific on the steps to reproduce your problem.
Don't forget that the form ClientSize will be brought down to zero when minimizing, so all the docked controls will be resized to have a zero height too. So if you have code in Resize event (or in OnResize method) of your scrolling panel, and you probably do have code there, don't forget to check if a zero height is ok for all the processing you do there.
I've never experienced any issue with the "scrollable panel" control i've made, even when docking it to fill, left, or anything. I just tried checking the "left" property after resizing to Maximized, Normal and Minimized, and it always stays at zero.
If you really want me to help the best would be to post a smaple project reproducing your problem
Etienne.
|
|
|
|
|
Hi everybody!!
Can anybody tell me how to write an image-object from C# into MS Access?
A code example would be useful!
Thanks a lot
SeDoHo
|
|
|
|
|
I use the following example to insert BLOBs into SQL tables, I would think if you change the SqlCommand to OleDbCommand it might work.
public void InsertBLOB(string Table,byte [] BLOB)
{
string Command="INSERT INTO "+Table+" (FileName,BLOB) VALUES ('MyFile',@MyBlob);
SqlCommand addEmp = new SqlCommand(Command, dbConn);
SqlParameter Param = addEmp.Parameters.Add("@MyBlob",SqlDbType.Image,(int)BLOB.Length);
Param.Value=BLOB;
addEmp.ExecuteNonQuery();
}
|
|
|
|
|
Hi All,
Does any body know how to create context help for GroupBox control in C#? The System.Windows.Forms.HelpProvider class is working fine for any other controls except for Groupbox.
Here is how you can reproduce it:
Create a form, in its properties, set the MinimizeBox and MaximizeBox to false, and set HelpButton to true, then you will see a little question mark in the title bar.
Drag any controls from the toolbox to the form, remember to include a groupbox.
Drag “HelpProvider” from the toolbox into the form
Now in the properties of every control, you will see “HelpKeyword on helpProvider1”, “HelpNavigator on helpProvider1”, “HelpString on helpProvider1”, “ShowHelp on helpProvider1” in the misc panel.
For every control, set “ShowHelp on helpProvider1” to true and input whatever you like in the ”HelpString on helpProvider” row.
Ok, it’s done. You will see the context help is working for any control, except for the groupbox. Do we need to take special care of GroupBox control?
Thanks,
Renee
|
|
|
|
|
Hi guys,
does anybody know, how I can get information (name, id..) about every control(button, label...) that is
located on a Form?
thanks in advance
Jörg
|
|
|
|
|
Hi,
try this :
static void GetControlsInformation ( Control parent_ctrl )
{
foreach (Control ctrl_temp in parent_ctrl.Controls)
{
DoSomethingWith ( ctrl_temp.Name );
DoSomethingWith ( ctrl_temp.Size );
etc..
GetControlsInformation ( ctrl_temp );
}
}
then to get information for all the controls on the form, use :
GetControlsInformation (my_form);
Etienne.
|
|
|
|
|
I want to do an application in which the pda should store the data when the user is at field work and should be updated in to my pc sql data base when the pda is connected to my pc
thanks in help
Any code please mail to chatcops007@yahoo.com
|
|
|
|
|
Hi Prasadepparla,
there are several ways to build such an application, which synchronizes data from the pda to a sql data base:
1) If you are using MS SQL Server as the pc sql data base, then you should take a look at SQL CE, which is designed for acting with data on a pda. SQL CE allows you to change the data at the pda and then to synchronize the changes with the pc sql data base.
Advantages:
- SQL CE is free and fully supported by SQL Server
- SQL CE is also supported by the CF
2) Second option is to build the application with UltraLite.NET and the Sybase MobiLink-Synchronization-Server. Basically it is the same like working with the SQL CE, but the problem is, that these Components are not free, you also have to pay for UltraLite.NET (same like SQL CE).
Advantages:
- Supported by CF
- Designed especially for snychronisation
3) Another possibility I dont know.
Hope this answers your question. If not, post again and I will try to answer your question.
Sebastian Martens
|
|
|
|
|
THANKS,
So i have to install SQL CE on my pda for usage
can i use file system to store records in pda with pda windows form and retrive them by my pc windows form and store them in sql server
please help me the namespaces which i have to use for file storing in pda.
chatcops007@yahoo.com
|
|
|
|
|
SQL Server CE uses a file-based database that you can store anywhere on your PDA. There are many ways of sync'ing this with a SQL Server database (like on a corporate server), though. When you install SQL Server CE, you can set up a replication schedule both on a schedule and on certain (limited) events, like sync'ing your Pocket PC.
You can download SQL Server CE and read about replication, .NET Compact Framework classes (defined in the System.Data.SqlCe namespace), and many other articles about the scenario you want from http://msdn.microsoft.com/SQL/SQLCE/default.aspx[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
this is a good question. But unfortunately I have to say, that I don't know. I've heard about this technique but for myself I didn't used it.
In my PDA project I choosed the second option.
But I think, Mr. Heath Stewart or somebody else can help you.
Sorry
Sebastian Martens
|
|
|
|
|
You should also take a look at the Application Guidance: Data Lay[^] section of the Microsoft Patterns and Practices web site, which goes into this in great detail. Especially read the Caching Architecture Guide for .NET Framework Applications[^].
For simple updates, you could use the DataSet , but I warn that with .NET 1.x the only storage format is XML (not very compact; even using a BinaryFormatter still serializes the DataSet to XML) and has its limits, such as requiring that the whole structure is loaded into memory to manipulate it and it can be slow with more data. If you need to store more than a few dozen records, then checking out better caching strategies is a very good idea.
Besides the Patterns and Practices web site articles mentioned above, there have been a number of articles covering this and similar topics on MSDN[^] that I recommend you browse or search to find them.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello All
I am looking for a control property which works like .enable=false; without grayscaling or highlighting the control.
- or -
how to suppress keypress and mouse events for specific controls like checkbox, listbox, radiobuttons ....
Does anybody have an idea ?
Thanks in advance
fracalifa
|
|
|
|
|
In Enter Event handler of the control, try to focus on different control. like
private void comboBox1_Enter(object sender, System.EventArgs e)
{
this.textBox1.Focus();
}
Hope this works...
|
|
|
|
|
Hello Jay
this is the way I have just realized and I have also some functions to suppress keypress events, but what are you doing when there is no free field to focus to? That's all not satisfactorily !
Thanks
Some more ideas ?
|
|
|
|
|
I also agree with you. The solution is not satisfactory. I had the fix the same problem using the above solution, that is why, I posted...
BTW, If you get some different way of achieving the same. Do post the solution.
|
|
|
|
|
Hi All
I'm having a problem stated below:
I've populated a dataset from multiple tables and then bind the datagrid with this dataset. Now when the datagrid contents are changed by the user, I want to propagate these changes in the original tables. What is the most convenient way to accomplish this? I shall be very thankful for any expert advice.
Truly yours
Rashid
|
|
|
|
|
Read the SDK documentation for the DataAdapter.Update method, which describes in rather nice detail what is required and basically how it works. You use a DataAdapter -derivative - like SqlDataAdapter - with the InsertCommand , DeleteCommand , and UpdateCommand specified (in addition to the SelectCommand , which is both required and assumed since you already have a DataSet . Based on a DataRow 's DataRowState , the record will be added, updated, or deleted.
Generally you should specify an INSERT statement followed by a SELECT statement for the InsertCommand . This is because any auto-generated fields defined on the database may be different (and most likely will) than what is in your DataSet . After inserting the row, the select will make sure your DataSet contains the right data.
If you are sending this DataSet across the wire to be updated, first call DataSet.GetChanges to get a DataSet of only the changes. This is only necessary if you send the DataSet across the wire before passing it to DataAdapter (like in a typical 3-tier design). Do not call DataSet.AcceptChanges , however, otherwise all the change-tracking information is lost. DataAdapter.Update will do this upon successful completion of the update.
Read http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemdatacommondataadapterclassupdatetopic.asp[^] for more information.
You can also click "Search comments" above and search for "DataAdapter", for example, for previous discussions about this. We have talked about it quite a bit in this forum over the years.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
My problem is that I can't restart my remoting server. This is how I
start the server:
m_ServerSinkProvider = new BinaryServerFormatterSinkProvider();
m_ServerSinkProvider.TypeFilterLevel = TypeFilterLevel.Full;
m_Props.Clear();
m_Props.Add("port", nPort);
m_Props.Add("typeFilterLevel", TypeFilterLevel.Full);
m_TcpChannel = new TcpChannel(m_Props, null, m_ServerSinkProvider);
ChannelServices.RegisterChannel(m_TcpChannel);
RemotingServices.Marshal(InstanceOfRemoteserverClass, "DataHandler");
This is what I do when I stop the server:
RemotingServices.Disconnect(InstanceOfRemoteserverClass);
ChannelServices.UnregisterChannel(m_TcpChannel);
When I try to start the server again, I do the start part again. When
I restart, I get an exception: only one usage of each socket address
(protocol/network address/port) is normally permitted. This is caused
by:
m_TcpChannel = new TcpChannel(m_Props, null, m_ServerSinkProvider);
This exception will occur only if my client has connected atleast
once.
The reason I need to create new TcpChannel every time server is
started is that the user can decide which port the server listens. So
the user can start the server with port 9000, stop the server, change
port to 9001 and start the server again. Or it can just stop and start
the server with the same port for some reason.
So how can I design the server so that it can be started and stopped
as many time as needed? Can I change the port in the created
m_TcpChannel without creating a new instance of it everytime?
Any help will be highly appreciated.
Thank you
|
|
|
|
|
At first glance, it would seem the problem is that you're not closing the first TcpChannel . When you instantiate a new one, the first TcpChannel remains active until the GC finalizes it - assuming nothing else is referencing it. This will happen when 1) your machine is idle, 2) when memory is or is nearly exhausted, or 3) when you call GC.Collect (not a good idea since this is a synchronous (i.e., blocking) call that may take a while). Be sure to call TcpChannel.StopListening .
You actually shouldn't need to re-allocate the channel, though. IF the remoting object is not listening the channel does nothing. You would have an open port, but a port that goes no where. Just something to consider.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks a lot for helping. I added TcpChannel.StopListening, but it didn't work. The TcpChannel does remain active (as you assumed), because it is a member variable. So the old TcpChannel exists when I create a new instance of TcpChannel to the same member variable. I'm a neebie to remoting (and to also C#), so I don't really know what's going on, so the reason for the member variable is that I can use it to UnregisterChannel when I disconnect. Can I avoid using member variable and get the current tcpchannel somehow for unregistering or what should I do when I disconnect in order to be able to reconnect? Also, could I change the port in the current TcpChannel when it is not registered or listening with out creating a new instance of it?
Thanks
|
|
|
|
|
Re-instantiating it creates a new instance and assigns that instance to the field ("member variable" as you called it, which is incorrect, BTW). The old field - if nothing else references it - will be finalized (destroyed) eventually, but there's no garuantee when). Don't re-instantiate it.
Actually, you should consider using .config files to configure remoting. If you ever need to change properties, a server address, or the remoting object base location with how you're doing it now, you would have to change your code, re-compile, and test it all over again. If you use .config files the RemotingConfiguration.Configure method you get everything you did without the hastle and in a way that you can change just by editing the .config file (an XML file) and re-starting the application. If you implement two different AppDomains with one watching for changes to the file, you can take-down the other AppDomain that hosts the remoting object and re-start it. This is basically how ASP.NET works (when you edit Web.config the ASP.NET web application is reloaded, or all ASP.NET web applications are reloaded if you edit the machine.config or the virtual host's root Web.config file).
I recommend picking up a good book on Remoting, like Microsoft .NET Remoting[^] (for beginners and intermediate developers) from MS Press and/or Advanced .NET Remoting[^] from Ingo Rammer.
.NET Remoting is complex and very abstract. Either of these books can really help sort-out the details and give you ideas about how to better implement a remoting solution.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have a usercontrol with 2 basic .NET controls (one label and one textbox for example).
When i drop such a control on a form in design time, everything is fine, i can click on it anywhere to select it, resize it, etc.
But now when i try to drop a panel on the form and drag/drop my UserControl into the panel, then i can't select the UserControl anymore. Designer seems to be trying to select the inner control (the textbox or the label) but also fails. When i click on the textBox part of the usercontrol, then i can type text in, as if textbox was in runtime.
I'd have thought it would be a known issue, but i couldn't find anything about it, nor could i find a workaround. Could anyone help, please ?
Thannk you !
Etienne.
|
|
|
|
|