| Updating a windows forms control from a thread |
|
 |
Index ‹ DotNet ‹ Net Framework
|
- Previous
- 1
- Winforms >> No Touch Deployment Error QuestionHI,
I am getting this error when I try to create a new instance of one of my
forms.
--
System.Security.SecurityException: Security error.
--
This error is thrown in the CTOR on the MyBase.New() call.
At this stage I have already created and displayed several other forms right
before this step, so it doesn't make sense why this particular form would
fail it is just a Standard windows form, with Menus/toolbars on it. It
doesn't even tell my what kind of security error
TIA,
--
Paul
- 2
- Visual C#.Net >> linking to enumeration members in xml commentsi often see in MSDN and third party component providers link to enum
members in their docs. but if i try to do something like <see
cref="MyEnum.Member1"/> i always get an error from the compiler, that
the member doesn't exist or something. how can i link to members of an
enumeration, like i link to methods in other classes?
- 3
- Winforms >> Click Event HandlerI have a C# .net 2003 program that has a processing loop in a click event
handler for one of the form's controls. The loop has a DoEvents
and a Thread.Sleep for each iteration to simulate a lengthy process. I want
to be able to have the user click a cancel button to set a flag to stop the
looping but I have found that the first click on another control while in
the click event of the first control is not caught by the program. Sometimes
takes many clicks to work at all. Does anyone know what is happening here ?
- 4
- Winforms >> Access to the internal property grid combo box controlAbybody knows how the PropertyGrid manage the ComboBox control?
I know to use the TypeConverter so the ComboBox are used if the user clicked
in the property. But I want the access to window control so I can use the
void WndProc(ref Message m) method of the ComboBox.
Thanks
Thomas
- 5
- 6
- Visual C#.Net >> Conservar estado control personalizadoHola a todos:
Estoy intentando hacer un control y necesito mantener el
estado de la siguiente colección que he creado:
public struct ColumnaGrid
{
public string TituloCabecera;
public int LongitudCabecera;
.........
}
[Serializable()]
public class ColeccionColumnasGrid:System.Collections.CollectionBase
{
public ColumnaGrid Item(int indice)
{
return (ColumnaGrid) List[indice];
}
public void Add(ColumnaGrid objColumnaGrid)
{
List.Add(objColumnaGrid);
}
.......}
La estoy intentando guardar en el viewstate pero no hay
forma, uso lo siguiente.
public ColeccionColumnasGrid ColumnasGrid
{
get
{
ColeccionColumnasGrid columnasGrid;
columnasGrid=(ColeccionColumnasGrid) ViewState ["columnasGrid"];
return columnasGrid;
}
set
{
ViewState["columnasGrid"]=value;
}
}
He leido algo de que hay que serializarla pero no se como
hacerlo.
A ver si alguien me puede echar una manita.
Muchas gracias.
.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- 7
- ADO >> Tablemappings and join?Hi,
I have this sql command:
Select recommendation, timescale from audits, auditItems where
AuditItems.ParentAuditID = Audts.AuditID and Audits.SupplierId = '" &
ComboItem.Value & "'"
So what do i set tablemappings to?
I usually do this:
myDataAdapter.TableMappings.Add("Table", "Audititems")
but that doesnt work... Any ideas?
Thanks,
Dan
- 8
- ADO >> SqlDataAdapter and DataSetWhen you call Fill method passing a DataSet object and table name, is that
table name associated with the SQL Server table name or just the moniker
that will be attached to the generated table inside thee DataSet's
TableCollection? What if you call Fill() without passing a table name, does
SqlDataAdapter generate some name?
- 9
- Visual C#.Net >> Cannot call Invoke or InvokeAsync on a control until the window handle has been createdHi
I am having this InvalidOperationException with message Cannot call Invoke
or InvokeAsync on a control until the window handle has been created
This is raised when i try to invoke a method with arguments
I need to do this as the method is being called Asynchronously from
elsewhere using delegate's BeginInvoke method.
The form is well created/initialized yet the messages states otherwise.
Cant extract a sample code out of my app.
Let me know if the code is needed for the problem.
All controls on the form are in a panel. The form itself isnt show, but the
panel is shown as a child control of some other panel. Can this be the
problem.
Thank you
rawCoder
- 10
- ADO >> Extra DataColumn's in DataTableHave a strange problem using a sproc to populate a DataTable.
The sproc itself is fairly simple and returns a selection of columns from
three tables, a master table and two additional tables which are joined via
a LEFT JOIN.
The resultant DataTable schema after a fillschema looks good however after
a 'fill' the DataTable has two extra columns at the end which represent the
unselected columns from the two LEFT JOIN tables. These columns do not form
part of the SELECT statement yet are appearing in the DataTable with all
values set to null.
I have tried the same query with a DataReader and see the correct columns
(obviously executing the same sproc from query analyser shows the correct
column set) therefore it appears to be a DataAdaptor issue which is somehow
pulling down these unselected columns. This problem is a right pain as the
I am binding a DataGrid to the DataTable via a DataView and the extra
columns appear at the end of the grid.
I know I could remove the columns via TableStyles however I might change
the database schema at some point and I would need to know dynamically at
run-time which columns were garbage and at the moment I can't see any
properies on these columns which I could process against.
This looks like a bug to me therefore interested if anyone has come across.
Can post sample code (c#) and sproc if anyone would like to see.
Regards
Paul
- 11
- Visual C#.Net >> MSMQ triggerApart from designing a timer to examine the queue, I know
that the new version of MSMQ over XP/2003 platform
provides a way called 'MSMQ trigger', anyone had some
experience of using it from programmer's point of view?
thanks in advance
- 12
- 13
- Dotnet >> Smart Client DeploymentI am trying to deploy my Smart Client (it accesses a Web Service) on to a server.It works fine in my machine and also works when others access it from my machine.
But when deployed to another server it does not run and opens the debugger.I tried with Full trust yet it does not work.
Please help me out.
- 14
- Winforms >> New to WindowsFormsHi I am learning windows fomrs and started with the sample in the quickstart
tutorials and I am not able to display the control on my aspx page.
I created a control library with one simple control having a panel and a
button. panel's visible property is false by default and I added color to
panel.
On the button press event , I set the visible property of the panel to true
to show the panel.
This control is created as test1.dll and then added to a web application and
added to aspx page as an object and calling with the classid property to
display the control. I have also set the objects property "VIEWASTEXT' .
The problem is that the aspx page does show the placeholder but does nto
display the control.
what am I doing wrong?
Please advice.
thanks
sam
- 15
- Winforms >> Problem with forms not properly disposedTo be able to explain what's happening, I will use a short example:
The example is created in VB.Net 1.1.
I have a form with a combobox on it. The datasource is set to a global
datatable object which is instanciated on a vb module.
I instanciate the form, set the datasource, valuemember and displaymember on
the combobox. Then i dispose the form. After the form is disposed and I do
any changes to the global datatable (e.g. clear all rows), the
SelectedIndexChanged event on the combobox is still triggered.
How is that possible?
Any help would be appreciated.
Regards, Rolf F.
|
| Author |
Message |
c_brotherton

|
Posted: Mon Dec 27 12:11:35 CST 2004 |
Top |
Net Framework >> Updating a windows forms control from a thread
I've gotten this question a couple of times in interviews and I don't know
what they are looking for:
How do you update a control's property, such as a textbox.text property,
from a thread, in .NET? It seems to me you just update it normally. What
are the interviewers looking for here? Thanks.
- W
DotNet75
|
| |
|
| |
 |
Herfried

|
Posted: Mon Dec 27 12:11:35 CST 2004 |
Top |
Net Framework >> Updating a windows forms control from a thread
"DW" <EMail@HideDomain.com> schrieb:
> I've gotten this question a couple of times in interviews and I don't know
> what they are looking for:
>
> How do you update a control's property, such as a textbox.text property,
> from a thread, in .NET? It seems to me you just update it normally. What
> are the interviewers looking for here?
Always create your forms in your application's main UI thread. Instance
members of Windows Forms forms and controls are not safe for multithreading,
so accessing them directly can cause problems. In addition to that, your
forms need a message pump which is normally provided by the app's main UI
thread.
More information:
Multithreading in Windows Forms applications
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=multithreading&lang=en>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
|
| |
|
| |
 |
Picho

|
Posted: Mon Dec 27 12:13:02 CST 2004 |
Top |
Net Framework >> Updating a windows forms control from a thread
Updating the GUI from a working thread is a big no-no...
(thats just me quoting someone here)
Picho
"DW" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> I've gotten this question a couple of times in interviews and I don't know
> what they are looking for:
>
> How do you update a control's property, such as a textbox.text property,
> from a thread, in .NET? It seems to me you just update it normally. What
> are the interviewers looking for here? Thanks.
>
> - W
>
|
| |
|
| |
 |
DW

|
Posted: Mon Dec 27 12:17:34 CST 2004 |
Top |
Net Framework >> Updating a windows forms control from a thread
Thanks Picho. Then specifically, how would you do that? Could you provide
a small code example. I've been looking for one unsuccessfully. Thanks
again.
- DW
"Picho" <EMail@HideDomain.com> wrote in message
news:%238OE1%EMail@HideDomain.com...
> Updating the GUI from a working thread is a big no-no...
>
> (thats just me quoting someone here)
>
>
> Picho
>
> "DW" <EMail@HideDomain.com> wrote in message
> news:EMail@HideDomain.com...
>> I've gotten this question a couple of times in interviews and I don't
>> know what they are looking for:
>>
>> How do you update a control's property, such as a textbox.text property,
>> from a thread, in .NET? It seems to me you just update it normally.
>> What are the interviewers looking for here? Thanks.
>>
>> - W
>>
>
>
|
| |
|
| |
 |
Picho

|
Posted: Mon Dec 27 12:38:48 CST 2004 |
Top |
Net Framework >> Updating a windows forms control from a thread
Well, I am no expert but...
I have this good book by Chris Sells - " Windows Forms Programming in C#".
there is a whole chapter discussing multi-threaded UI, and how shared data
is to be accessed using monitors.
personally (I might get banned from this group for my bad habbits...), I
usually raise events from the worker thread that have handlers in the UI
thread that reflects changes in the UI.
an example can be provided if you provide a skeletal context of your
specific problem.
Picho.
"DW" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> Thanks Picho. Then specifically, how would you do that? Could you
> provide a small code example. I've been looking for one unsuccessfully.
> Thanks again.
>
> - DW
> "Picho" <EMail@HideDomain.com> wrote in message
> news:%238OE1%EMail@HideDomain.com...
>> Updating the GUI from a working thread is a big no-no...
>>
>> (thats just me quoting someone here)
>>
>>
>> Picho
>>
>> "DW" <EMail@HideDomain.com> wrote in message
>> news:EMail@HideDomain.com...
>>> I've gotten this question a couple of times in interviews and I don't
>>> know what they are looking for:
>>>
>>> How do you update a control's property, such as a textbox.text property,
>>> from a thread, in .NET? It seems to me you just update it normally.
>>> What are the interviewers looking for here? Thanks.
>>>
>>> - W
>>>
>>
>>
>
>
|
| |
|
| |
 |
Herfried

|
Posted: Mon Dec 27 15:08:25 CST 2004 |
Top |
Net Framework >> Updating a windows forms control from a thread
"DW" <EMail@HideDomain.com> schrieb:
> Thanks Picho. Then specifically, how would you do that?
'Control.Invoke'/'Control.BeginInvoke'. You'll find more information in my
other reply.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
|
| |
|
| |
 |
SPG

|
Posted: Mon Dec 27 15:25:57 CST 2004 |
Top |
Net Framework >> Updating a windows forms control from a thread
Herfried,
We have a problem based on updating the UI from worker threads..
Our app uses a docking style MDI UI, where each form is capable of receiving
updates from a central "controller", as well as performing form specific
tasks.
We use the Control.Invoke() lark, which of course works, but when we are
making updates to many forms (We could have a form showing a graph, one a
table, one a report etc.. all based on their own interpretation fo the data
being pumped out) we find that the UI becomes very slow, sticky and
unmanageable.
Is is possible to assign each form its own UI thread/message pump so they
can all act independantly of each other?
Steve
"Herfried K. Wagner [MVP]" <EMail@HideDomain.com> wrote in message
news:O3WuA%EMail@HideDomain.com...
> "DW" <EMail@HideDomain.com> schrieb:
>> I've gotten this question a couple of times in interviews and I don't
>> know what they are looking for:
>>
>> How do you update a control's property, such as a textbox.text property,
>> from a thread, in .NET? It seems to me you just update it normally.
>> What are the interviewers looking for here?
>
> Always create your forms in your application's main UI thread. Instance
> members of Windows Forms forms and controls are not safe for
> multithreading,
> so accessing them directly can cause problems. In addition to that, your
> forms need a message pump which is normally provided by the app's main UI
> thread.
>
> More information:
>
> Multithreading in Windows Forms applications
> <URL:http://dotnet.mvps.org/dotnet/faqs/?id=multithreading&lang=en>
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
>
|
| |
|
| |
 |
DW

|
Posted: Mon Dec 27 16:24:59 CST 2004 |
Top |
Net Framework >> Updating a windows forms control from a thread
Thank you to Herfried and Picho. Now I understand how to do this.
- David
"Herfried K. Wagner [MVP]" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> "DW" <EMail@HideDomain.com> schrieb:
>> Thanks Picho. Then specifically, how would you do that?
>
> 'Control.Invoke'/'Control.BeginInvoke'. You'll find more information in
> my other reply.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
|
| |
|
| |
 |
Picho

|
Posted: Mon Dec 27 16:37:07 CST 2004 |
Top |
Net Framework >> Updating a windows forms control from a thread
Herfried what do you say about my event drivven solution?
"Herfried K. Wagner [MVP]" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> "DW" <EMail@HideDomain.com> schrieb:
>> Thanks Picho. Then specifically, how would you do that?
>
> 'Control.Invoke'/'Control.BeginInvoke'. You'll find more information in
> my other reply.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
|
| |
|
| |
 |
Herfried

|
Posted: Mon Dec 27 17:01:54 CST 2004 |
Top |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ Net Framework |
- Next
- 1
- Microsoft Project >> Project 2007 Not Enough Memory to PrintOur schedule won't print more than once at a time. If we do a print preview,
it won't print at all. The message, "There is not enough memory to complete
the operation. To free up available memory, close programs, projects, or
windows you aren't using, and then try again." I can close all but Project,
and it still won't print. The only thing that works is to close Project,
reopen it, then open the project without previewing it. It prints fine, but
cross your fingers. If it is two pages wide, you won't know until you waste
a ream of paper.
- 2
- ADO >> Column Expression questionHello!
After filling table into DataSet (ds), I added following line ...
ds.Tables(0).Columns("MyColumn").Expression = "<MyFormula>"
... and calculation is working fine - but I need to save this calculated
field value into database also because it makes easier to make SELECT
queries later and it's quite often needed value in many cases too. This
"MyColumn" is as a field in database too, and is used too when making
DataAdapter in SELECT-query.
When trying to save, I'll get error message ...
"The column mapping from SourceColumn 'MyColumn' failed because the
DataColumn 'MyColumn' is a computed column."
Is it possible to save computed column values into database table at all?
--
Thanks in advance!
Mika
- 3
- Visual C#.Net >> Windows Services and System.Web.UI.Page.RequestHi.
I am wondering how to handle AbsoluteUri values inside windows
services?
It seems that the absoluteuri is called from the System.Web.UI.Page
namespace
which is not allowed inside a windows service (that I am aware of).
But, I need to call the following inside my service:
Request.UserAgent,
Request.UserHostAddress,
Request.Url.AbsoluteUri
Since I can't use the Request object (in the sense of
System.Web.UI.Page),
how do I access the above values from within my service??
Thanks for your help.
Peter
- 4
- Microsoft Project >> Project should provide "print across then down" like ExcelIs there a way to "print across then down" in MS Project like you can do with
Excel? I'm printing my Gantt chart 2 pages wide by 5 pages high, and it's
annoying that the bars that go with page 1 are on page 6.
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/community/en-us/default.mspx?mid=941d70e0-2117-47fa-a491-1ff5a3154e4d&dg=microsoft.public.project
- 5
- Microsoft Project >> "resource usage"- view errorHi..
I open a Project and use the reource-usage view. I choose a resource and
look at the actual work by other enterprise Projects. The actual work of
all the other projects is 0 although I am sure thet they are not .
What is the reason for this problem?
Thanks..
- 6
- Visual C#.Net >> Running code compiled in Framework 1.0 with Framework 1.1Hello,
We have an application written using Framework 1.0 (VS2002), we have
deployed it to a server that only has Framework 1.1 installed, the
client does not want to Install Framework 1.0 because it might have an
impact with other .Net applications written using Framework 1.1, so
rather not getting into a debate with the client I have agreed to
investigate if we could get our application to run using Framework 1.1
without recompiling it. Is this possible, if so how?
Thanks,
- 7
- ADO >> Convert System.Transactions.Transaction.Current to System.Data.Common.DbTransaction?I have been trying to figure out a way to convert
System.Transactions.Transaction.Current to System.Data.Common.DbTransaction
with no luck so far. Is this even possible? I am using the Enterprise
Library, and several of their calls take in a transaction, but it is of type
DbTransaction. I have tried straight casting, but it is not compileable.
DbTransaction transaction = (DbTransaction)Transaction.Current;
Error 1 Cannot convert type 'System.Transactions.Transaction' to
'System.Data.Common.DbTransaction'
- 8
- Net Framework >> Wrong Byte order when writing with a binary writerHi!
I have the following problem:
I want to write an integer value (e.g. 14) with a binarywriter.
The written file contains the following entry:
0E 00 00 00
I want the entry to be the following:
00 00 00 0E
Does anybody know how to get the desired result (Language vb)?
Thanks in advance,
Marko
- 9
- 10
- Visual C#.Net >> Modify IIS Folder PermissionI need to change Directory Security permission on folders under the IIS
default web site tree:
Internet Information Services
- Machine Name
- Web Sites
-Default Web Site
+testfolder
Specifically: on the the Directory Securty Tab (right click on a folder
under the Default Web Site) click the edit button next to Anonymous access
and authentication control, uncheck Anonymous access, check Basic
authenticatoin and enter Domain and password...and finally uncheck Integrated
Windows authentication.
I may have chosen the wrong class "IIsWebFileSetting" to change the
properties described above...which also could have added to the confusion.
I am using windows server 2000, with IIS 5.0
I know in the end we are really just changing/entering data in the IIS
metabase, right?
Thank you so much for taking the time to help....I'm really stuck on this one.
Mark
- 11
- ADO >> Problems with return parameter from Oracle functionI have an oracle function that looks like this:
AuthenticateUser(UserName IN VARCHAR2, pPassword IN VARCHAR2, AppName IN
VARCHAR2) RETURN VARCHAR2
Using the Oracle client provider, I'm setting up my command text as:
:results = call AuthenticateUser(:username, :password, :appname)
I then add parameters as follows:
OracleParameter p = new OracleParameter("results", OracleType.VarChar);
p.Direction = System.Data.ParameterDirection.ReturnValue;
p.Size = 255
xcmd.Parameters.Add(p);
xcmd.CommandText = _authenticateCall;
xcmd.Parameters.Add(new OracleParameter("username",
OracleType.VarChar)).Value = "abc";
xcmd.Parameters.Add(new OracleParameter("password",
OracleType.VarChar)).Value = "123";
xcmd.Parameters.Add(new OracleParameter("application",
OracleType.VarChar)).Value = "Test";
However, when I execute the command, I get an ORA-01036: illegal
variable name/number exception.
If I leave out the :results paramater from both the command text and
don't add it to the parameters of the command, then I can call the
function w/o the exception. So it seems like .Net can't figure out how
to bind my parameters correctly (this is more or less confirmed by the
stacktrace of the exception).
In every example I've seen, this is the recommended way of calling a
function. What am I missing that would make it bind the return parameter
correctly?
- 12
- Visual C#.Net >> IsAccountLocked and LDAPI think IsAcountBlocked does not work with Active Directory if the conection is an LDAP:// configuration. Am I right? Does someoe have an example with WinNT://
Thanks
Jason
- 13
- Microsoft Project >> Printing in MS Project 2007Does printing in MS Project 2007 just not work like it did in 2003.
I am having a terrible time getting all my info on my gantt chart to print
and it will not do a "fit to" at all.
Starting to wonder if I should just go back to 2003.
Extremely frustrated.
- 14
- Dotnet >> icon for desktop shortcut not workingHi all,
I am attempting to deploy a vb.net application. That is working fine.
I also configured the installer so shortcuts for the application
would appear on the desktop and the user program menu. That's working
too. What isn't working is the icon that I am setting for these
shortcuts. The icon is a .ico file that works fine for the program
itself, and for any shortcuts that I manually create. After I created
the shortcuts of the primary output in the file system editor, I set
the icon property to my .ico file. However but the shortcut s that
result from installation still show your basic, generic "file" icon.
Anybody have any idea why the icon isn't appearing on the shortcuts
created by installer? I followed the .net help file instructions
exactly!
thanks,
Mike Cooper
- 15
|
|
|