473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Invoking in asp.net C#

Hi there,

I'm trying to make a basic app in asp.net written in C#. I managed to
get it working in a appliaction, but when i make inside an
webapplication, it wont work. Any ideas?

private void Nameserver_SignedIn(object sender, EventArgs e)
{
UpdateContactListDelegate updateListBox = new
UpdateContactListDelegate(this.UpdateContactList);
-- ListBox1.Invoke(updateListBox);
}

public delegate void UpdateContactListDelegate();
private void UpdateContactList()
{
ListBox1.Items.Clear();
System.Windows.Forms.MessageBox.Show("D");
foreach (Contact contact in msn.ContactList.All)
{
this.ListBox1.Items.Add("C: " + contact.Name);
}

}

The problem occures at "ListBox1.Invoke(updateListBox);". I have to
invoke it couse it goed cross threading. The error i get is
"System.Web.UI.WebControls.ListBox' does not contain a definition for
'Invoke"

Sep 21 '07 #1
2 1678
That's correct. You're thinking web controls behave like Windows Forms
controls, and they do not. A web page is stateless, and the entire Page class
is gone once the page has been sent to the browser.

Events in ASP.NET are handled via the postback mechanism.
You can get a lot of very helpful info at the asp.net site. Look for
"QUICKSTART".

-Peter

Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Oi**********@gmail.com" wrote:
Hi there,

I'm trying to make a basic app in asp.net written in C#. I managed to
get it working in a appliaction, but when i make inside an
webapplication, it wont work. Any ideas?

private void Nameserver_SignedIn(object sender, EventArgs e)
{
UpdateContactListDelegate updateListBox = new
UpdateContactListDelegate(this.UpdateContactList);
-- ListBox1.Invoke(updateListBox);
}

public delegate void UpdateContactListDelegate();
private void UpdateContactList()
{
ListBox1.Items.Clear();
System.Windows.Forms.MessageBox.Show("D");
foreach (Contact contact in msn.ContactList.All)
{
this.ListBox1.Items.Add("C: " + contact.Name);
}

}

The problem occures at "ListBox1.Invoke(updateListBox);". I have to
invoke it couse it goed cross threading. The error i get is
"System.Web.UI.WebControls.ListBox' does not contain a definition for
'Invoke"

Sep 21 '07 #2
That's correct. An ASP.Net application is not single-threaded, so you can
simply call the method.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

<Oi**********@gmail.comwrote in message
news:11**********************@19g2000hsx.googlegro ups.com...
Hi there,

I'm trying to make a basic app in asp.net written in C#. I managed to
get it working in a appliaction, but when i make inside an
webapplication, it wont work. Any ideas?

private void Nameserver_SignedIn(object sender, EventArgs e)
{
UpdateContactListDelegate updateListBox = new
UpdateContactListDelegate(this.UpdateContactList);
-- ListBox1.Invoke(updateListBox);
}

public delegate void UpdateContactListDelegate();
private void UpdateContactList()
{
ListBox1.Items.Clear();
System.Windows.Forms.MessageBox.Show("D");
foreach (Contact contact in msn.ContactList.All)
{
this.ListBox1.Items.Add("C: " + contact.Name);
}

}

The problem occures at "ListBox1.Invoke(updateListBox);". I have to
invoke it couse it goed cross threading. The error i get is
"System.Web.UI.WebControls.ListBox' does not contain a definition for
'Invoke"

Sep 21 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Prasad | last post by:
We are invoking a SQL DTS component (lets call it Comp1) built by us in another component (Comp2).Comp1 was built by creating the DTS package using the SQL DTS wizard and then saving it as a VB...
6
by: Patrick | last post by:
Following earlier discussions about invoking a .NET class library via ..NET-COM Interop (using regasm /tlb) at...
4
by: Joanna Carter \(TeamB\) | last post by:
I am trying to invoke an event using reflection. ////////////////////// public class Test { public event EventHandler NameChanged; public void CallEvent() {
25
by: MuZZy | last post by:
Hi, I'm currently rewriting some functionality which was using multithredaing for retrieving datasets from database and updating a grid control. I found that the grids (Infragistics UltraGrid,...
2
by: shanmani | last post by:
Hi, I am developing a .NET application which will invoke the methods from different COM / .NET DLLs. While invoking methods from .NET DLLs, I am encountering the following error. I have also...
0
by: Haxan | last post by:
Hi, I have an unmanaged application that converts a function pointer to a delegate and then pass this as a parameter(delegate) to a managed function which then invokes it. Currently Im able to...
0
by: balaji krishna | last post by:
Hi, I need to handle the return set from COBOL stored procedure from my invoking Java program. I do not know, how many rows the stored proc SQL fetches.I have declared the cursor in that proc, but i...
2
by: =?Utf-8?B?SmltIE93ZW4=?= | last post by:
Hi John, Hopefully this post will find its way back to you - or perhaps be answered by someone else. As I mentioned in my last post on the earlier portion of this thread, changing the...
1
by: imranisb | last post by:
Hi, I apologies if this type of question was posted before. I am invoking internet explorer and open the HTTPS website from my c# application like this: System.Diagnostics.Process proc =...
6
by: John O'Flaherty | last post by:
Hello. I have an ms acess database that I use to track my mp3 files. I have included code that lets me select and play files by invoking an mp3 player (Winamp). This is done by using visual basic...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.