|
Dear All,
Recently i have developed an c# application under 1024/800 resolution.
But now if i run this application under 800/600 resolution the forms controls does not show in its actual size.
For this now i did not show the forms controls while i runnig this application under 800/600 resolution.
Can anybody give me solutions regarding this?
Any help regarding this geatly appreciated.
Zakir
Software Programmer
|
|
|
|
|
Make use of Anchor and Dock properties of your controls, so they resize properly with your form.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
zakir-robi wrote: the forms controls does not show in its actual size.
What does that mean???
zakir-robi wrote: Can anybody give me solutions regarding this?
Use anchor properties for your controls.
|
|
|
|
|
i'm tring to make an application that has a tab control with multiple tab pages. for integrity purposes, i want a tab page to be rendered disabled as soon as the user moves tot he next. the only problem is that there is no enabled property for tab pages and the canfocus and canselect properties are read only. Please help me!
rzvme
|
|
|
|
|
You are correct in that you cannot disable a tab page, but you can either prevent a user from going back to a previous tab page or you can allow a user to go back to a previous tab page but disable all the controls on that tab page. The sample code below will disable all controls on a previous tab.
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControl1.SelectedIndex > highestTabIndex)
{
foreach (Control c in tabControl1.TabPages[highestTabIndex].Controls)
{
PropertyInfo pi = c.GetType().GetProperty("Enabled");
if (pi != null)
pi.SetValue(c, false, null);
}
highestTabIndex = tabControl1.SelectedIndex;
}
}
The code is the event handler for the SelectedIndexChanged event of a tab control named tabControl1. It also assumes the existence of a form level variable declared as:
private int highestTabIndex = 0;
There are some limitations of the code, for instance if you start on tabPage1 and then click tabPage3 by skipping tabPage2 the code will disable only the controls on tabPage1. You would need to check the new index versus the old index to see if they only differ by one otherwise you could select the next page. So in this example when tabPage3 was selected by skipping tabPage2 you could change the selected tab to tabPage2 and then disable tabPage1.
Tom Chester
|
|
|
|
|
Hi...
I am developing a MDI application. In that application i am creating forms dynamically, 1 per PC comport.
In each comport i am adding textbox.& i want my application should display the received data on my each comport. I have added SerialPoer.DataReceived event in my application.
But i am not able to display the received data on that dynamically created forms...
I am adding some code with this...please suggest me where i am doing mistake...
****************************************************************************************************
private SerialPort comport = new SerialPort();
TextBox tb = new TextBox();
foreach (string s in SerialPort.GetPortNames())
{
this.f1 = new VHLCOutputWindow_Form();
f1.MdiParent = this;
f1.Controls.Add(tb);
}
MY DataReceived Event-:
comport.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
string ReceivedData = comport.ReadExisting();
f1.Controls[0].Text = ReceivedData; //i've only 1 control added on that form(i.e. TextBox tb)
}
****************************************************************************************************
right now my PC is having only 1 port...& my form is getting created but i am not able to see the data received in that form...
Regards,
Vinay
|
|
|
|
|
According to MSDN the "DataReceived event is raised on a secondary thread when data is received from the SerialPort object". Therefor your event handler runs on this secondary thread too and shouldn't/cannot access UI controls. You have to use Invoke or BeginInvoke to get around this. Take a look at the following article[^] which should be a good starting point.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello All,
Does anyone know how to set the list index of a DataGridViewComboBoxColumn.
I have no problem populating and retieving the ValueMember. I just can't figure out how to set the DataGridViewComboBoxColumn to a specific item within its list.
Sounds simple right?
Your help is appreciated.
Kind Regards,
JimS
;^)
|
|
|
|
|
I am using a dataset on a table with an already defined primary key in an sql server 2000:
SqlCommand currentControllerCommand = new SqlCommand(currentControllerSQL,IDGSConnection);<br />
SqlDataAdapter currentControllerAdapter = new SqlDataAdapter(currentControllerCommand);<br />
DataSet currentControllerDS = new DataSet(); currentControllerAdapter.Fill(currentControllerDS,collector["TargetUsersTable"].ToString());
When later I try to update the table with the changes on the dataset:
SqlCommandBuilder cb = new SqlCommandBuilder(currentControllerAdapter);<br />
currentControllerAdapter = cb.DataAdapter;<br />
currentControllerAdapter.Update(currentControllerDS,collector["TargetUsersTable"]);
It tells me the following:
Error submitting changes to the Collector Database. Dynamic SQL generation for the UpdateCommand is<br />
not supported against a SelectCommand that does not return any key column information.
Why does it tell me that if I have already the primary key defined in the primary table?
Thanks for your thoughts!
mrclash
|
|
|
|
|
This is basically saying you can't autogenerate the command without primary key information.
If you want to use the CommandBuilder, you need to be aware of it's limitations.
The CommandBuilder classes can be used to build update commands for single-table select queries that include at least one unique column.
Your SQL command doesn;t include a unique column, so it cannot be used. Include the primary key in your select query, and it should work, as long as it is a single-table query. If probably looks something like this
Select col1, col2, col3 from table1 where col1 = somevalue
change it to
Select pkey, col1, col2, col3 from table1 where col1 = somevalue
If it is not a single-table query, you will need to build your own insert, update, and delete queries using the InsertCommand, UpdateCommand, and DeleteCommand properties.
|
|
|
|
|
What does the select command look like?
|
|
|
|
|
SELECT ID,Email,New FROM Collector_Users
Where ID is a primary key...
|
|
|
|
|
Hi,
Please excuse the lack of code. I don't have the source with me.
I'm builing an Server-Client based system and it's the first time I'm working with threading and socketing.
My UdpClient has a listener that's constantly waiting for incoming messages on a specific port. That listener runs on a seperate thread, which is defined in the class and the listen() method is handed as a new Threadstart.
Inside the method, the while loop checks if the application must continue listening before preparing to receive messages.
My problem is that when my application closes all the code terminates and runs out the bottom. But when I open Program Manager the process is still running and if the application starts again the port is already in use. Thus I must deduce that the listener thread did not terminate.
I tried calling the .Abort() method and it seems to work, but I can't manage to close the application completely.
My question is this: Is there a way to get a list of all threads started by my application and to terminate them manually?
Or alternatively: Is there a way I can force my application to terminate itself and all its threads?
"Build an idiot-proof application, and the world will create a bigger idiot."
|
|
|
|
|
Assign true to the IsBackground property of your thread.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks. Will try that.
Respect for 1-upping my signature...
|
|
|
|
|
OK, I did what you suggested and it worked like a charm, but I've now run into a problem of another kind.
I know that timers and multithreading don't really go together, but my app was working perfectly with 3 timers doing different things.
As soon as I made that thread background, 2 of the 3 timers stopped funtioning. They start and enable fine, but the tick event never fires.
After looking through the articles on here I can't find anything to solve my problem. Basically what I need is:
If there is no mouse movement for 20 seconds, hide a specific panel control.
Is there and easy way to do this?
|
|
|
|
|
For the need of one my application I have been numerously advised (here, on CodeProject) to use the Policy Manager.
But... the problem is.. I don't know what it is!
I have XP Home edition.
I looked in the Control Panel and the Accessories and I can't find it!
Where is it?
what is it?
On top of that it's to write an app for a dad wanting to monitor his kid.
I'm not sure this 'arcane' policy manager is the right solution...
|
|
|
|
|
Policy manager is hardly 'arcane'...
Obtuse, yes. Frustrating, yes. Arcane no.
I have never used XP Home Edition, only Professional, so cannot guarentee it is included in Home Edition.
Start -> Run -> MMC.exe <enter>
File -> Add/Remove Snap-In -> Add -> Group Policy Object Editor <ok> <ok>
As I do not know what you are trying to do, I cannot offer you any alternatives.
|
|
|
|
|
Thanks!
Now I have to experiment....
|
|
|
|
|
Hi all,
I try to programm a which captures a part of the screen. It works. But the form border type is sizable: That doesn't look good. If I set the form border type to none the form isn't sizable and movable. Is there any solution?
thanks for helping
dolce
btw: is it possible to set the opacity of an button or picturebox to 100% if the form by itself is semi transparent?
|
|
|
|
|
|
Thanks a lot this article would help in the future. I've found a solution which is very easy. In short:
* Create a form -> border none -> set the opacity of the form as you like.
* Define the events onMouseDown, onMouseUp and onMouseMove
* onMouse down set a bool to true, onMouseUp to false
* onMouseMove calcutate the new position of the form
* create a pictureBox in the lower right corner
* Define the events onMouseDown, onMouseUp and onMouseMove
* onMouse down set a bool to true, onMouseUp to false
* onMouseMove calcutate the new size of the form
That's all!
dolce
|
|
|
|
|
hi all
I am developing windows application, where i have login, other options pages,
In the main page i checking for the user idle time(in a timer), if the user idle for certain period i should display logout page and close the modal dialogs which is being displayed by the other pages.
For modal forms i am storing the current openned form in mainpage's object
during time out i will close the opened forms using this object's Close method,
But how can i close the messagebox which is displayed in other pages during logout. Is there any way that the mainpage can close or control the messagebox which has been displayed by other pages
note: Here pages are various user controls which willl be loaded on the Mainform's panel
Thanks and Regards,
Srini
|
|
|
|
|
write
Application.DoEvents();
before writeing
this.Dispose(); or this.Close();
|
|
|
|
|
What is suppose to dispose here either that user control or main form itself,
If i dispose the user control will it close the user control's message box.
I want dispose only the messagebox, not the user controls,
am i clearly explained situation?
|
|
|
|