Search Results

Search found 461 results on 19 pages for 'eventhandler'.

Page 11/19 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Comobox event SelectedValueChanged

    - by IordanTanev
    Hi, i have simple question may be someone asked it before me but i could not find it.Let say i have datatable that has some data from the database and i want to bind it to a combobox i use standart code like this comboBox1.BeginUpdate( ); comboBox1.ValueMember = "id"; comboBox1.DisplayMember = "name"; comboBox1.DataSource = dt; comboBox1.EndUpdate( ); The problem is during this binding the event SelectedValueChanged is fired.The problem is that rebind combo several times when outher values change and every time i must do sometihn like this comboBox1.SelectedIndexChanged -= new System.EventHandler( this.comboBox1_SelectedValueChanged ); my question is there a smarter way to skip the event when i comes from databinding not from user input.The problem is that i want to do it some how globaly in my control that inherits combobox and not to do it everytime in every from Best Regards, Iordand

    Read the article

  • asp.net how to add TemplateField programmatically for about 10 dropdownlist...

    - by dotnet-practitioner
    This is my third time asking this question. I am not getting good answers regarding this. I wish I could get some help but I will keep asking this question because its a good question and SO experts should not ignore this... So I have about 10 dropdownlist controls that I add manually in the DetailsView control manually like follows. I should be able to add this programmatically. Please help and do not ignore... <asp:DetailsView ID="dvProfile" runat="server" AutoGenerateRows="False" DataKeyNames="memberid" DataSourceID="SqlDataSource1" OnPreRender = "_onprerender" Height="50px" onm="" Width="125px"> <Fields> <asp:TemplateField HeaderText="Your Gender"> <EditItemTemplate> <asp:DropDownList ID="ddlGender" runat="server" DataSourceid="ddlDAGender" DataTextField="Gender" DataValueField="GenderID" SelectedValue='<%#Bind("GenderID") %>' > </asp:DropDownList> </EditItemTemplate> <ItemTemplate > <asp:Label Runat="server" Text='<%# Bind("Gender") %>' ID="lblGender"></asp:Label> </ItemTemplate> so on and so forth... <asp:CommandField ShowEditButton="True" ShowInsertButton="True" /> </Fields> </asp:DetailsView> ======================================================= Added on 5/3/09 This is what I have so far and I still can not add the drop down list programmatically. private void PopulateItemTemplate(string luControl) { SqlDataSource ds = new SqlDataSource(); ds = (SqlDataSource)FindControl("ddlDAGender"); DataView dvw = new DataView(); DataSourceSelectArguments args = new DataSourceSelectArguments(); dvw = (DataView)ds.Select(args); DataTable dt = dvw.ToTable(); DetailsView dv = (DetailsView)LoginView2.FindControl("dvProfile"); TemplateField tf = new TemplateField(); tf.HeaderText = "Your Gender"; tf.ItemTemplate = new ProfileItemTemplate("Gender", ListItemType.Item); tf.EditItemTemplate = new ProfileItemTemplate("Gender", ListItemType.EditItem); dv.Fields.Add(tf); } public class ProfileItemTemplate : ITemplate { private string ctlName; ListItemType _lit; private string _strDDLName; private string _strDVField; private string _strDTField; private string _strSelectedID; private DataTable _dt; public ProfileItemTemplate(string strDDLName, string strDVField, string strDTField, DataTable dt ) { _dt = dt; _strDDLName = strDDLName; _strDVField = strDVField; _strDTField = strDTField; } public ProfileItemTemplate(string strDDLName, string strDVField, string strDTField, string strSelectedID, DataTable dt ) { _dt = dt; _strDDLName = strDDLName; _strDVField = strDVField; _strDTField = strDTField; _strSelectedID = strSelectedID; } public ProfileItemTemplate(string ControlName, ListItemType lit) { ctlName = ControlName; _lit = lit; } public void InstantiateIn(Control container) { switch(_lit) { case ListItemType.Item : Label lbl = new Label(); lbl.DataBinding += new EventHandler(this.ddl_DataBinding_item); container.Controls.Add(lbl); break; case ListItemType.EditItem : DropDownList ddl = new DropDownList(); ddl.DataBinding += new EventHandler(this.lbl_DataBinding); container.Controls.Add(ddl); break; } } private void ddl_DataBinding_item(object sender, EventArgs e) { DropDownList ddl = (DropDownList)sender; ddl.ID = _strDDLName; ddl.DataSource = _dt; ddl.DataValueField = _strDVField; ddl.DataTextField = _strDVField; } private void lbl_DataBinding(object sender, EventArgs e) { Label lbl = (Label)sender; lbl.ID = "lblGender"; DropDownList ddl = (DropDownList)sender; ddl.ID = _strDDLName; ddl.DataSource = _dt; ddl.DataValueField = _strDVField; ddl.DataTextField = _strDTField; for (int i = 0; i < _dt.Rows.Count; i++) { if (_strSelectedID == _dt.Rows[i][_strDVField].ToString()) { ddl.SelectedIndex = i; } } lbl.Text = ddl.SelectedValue; } } Please help me....

    Read the article

  • Why does setting a form's enabled property crash the application?

    - by Ruirize
    private void launchbutton_Click(object sender, EventArgs e) { launchbutton.Enabled = false; Process proc = new Process(); proc.EnableRaisingEvents = true; proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; //The arguments/filename is set here, just removed for privacy. proc.Exited += new EventHandler(procExit); proc.Start(); } private void procExit(object sender, EventArgs e) { MessageBox.Show("YAY","WOOT"); Thread.Sleep(2000); launchbutton.Enabled = true; } 2 Seconds after I quit the created process, my program crashes. Why?

    Read the article

  • Silverlight Bind to TextBlock from RIA Services

    - by DaRKoN_
    I've a TextBlock that looks like so: <TextBlock Text="{Binding Name}" /> This is inside a <Canvas> with the DataContext set to MyClient which is in the ViewModel: public Client MyClient { get; private set; } // This is a RIA Entity, hence supports INotifyPropertyChanged public ViewModel() { MyClient = new Client(); LoadOperation<Client> loadClient = RiaContext.Load<Client>(RiaContext.GetClientsQuery()); loadClient.Completed += new EventHandler(loadClient_Completed); } void loadClient_Completed(object sender, EventArgs e) { MyClient = DB.Clients.Single(); } Setting MyClient like the above does not raise the PropertyChanged event. As such the UI is never updated.

    Read the article

  • Object reference not set to an instance of an object.....?

    - by jamal
    Hi guys I always got this error from my site and it keeps bugging me.I've been trying to figure out the cause of this error but I can't really figure it out. Here's the stacktrace: at BasePage.Page_PreInit(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Page.OnPreInit(EventArgs e) at System.Web.UI.Page.PerformPreInit() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) And on my basepage I only got this code: Imports Microsoft.VisualBasic Public Class BasePage Inherits System.Web.UI.Page Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit Page.Theme = "Something" If (Request.UserAgent.IndexOf("AppleWebKit") 0) Then Request.Browser.Adapters.Clear() End If End Sub Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender If Me.Title = "Untitled Page" Then Throw New Exception("Page title cannot be ""Untitled Page"".") End If End Sub End Class According to the stacktrace this always happens on my basepage preinit event.What do you think is the problem here guys?

    Read the article

  • Silverlight calling windows workflow foundation as a web service

    - by wissem
    hi, I'm trying to call a windows workflow foundation published as a web service from a Silverlight project. When I call it from a console application it works fine because I can add a web reference then I just make an instance of that webservice then I invoke the method I want. The problem is in the silverlight project cause i can just add a service reference so I find myself working with soap stuff that doesn't work at all, and here is the code: private void btnUpdate_Click(object sender, RoutedEventArgs e) { xxxxxxx.Workflow1_WebServiceSoapClient zer = new xxxxx.Workflow1_WebServiceSoapClient(); zer.demanderSubmitReportCompleted += new EventHandler<xxxxxxxxxxxxxxx.demanderSubmitReportCompletedEventArgs>(service2); zer.demanderSubmitReportAsync("zzz", 20000); } public void service2(object sender, xxxxx.demanderSubmitReportCompletedEventArgs e) { string a = e.Result; } plz help ,thanks

    Read the article

  • silverlight and windows workflow foundation

    - by wissem
    private void btnUpdate_Click(object sender, RoutedEventArgs e) { xxxxxxx.Workflow1_WebServiceSoapClient zer = new xxxxx.Workflow1_WebServiceSoapClient(); zer.demanderSubmitReportCompleted += new EventHandler<xxxxxxxxxxxxxxx.demanderSubmitReportCompletedEventArgs>(service2); zer.demanderSubmitReportAsync("zzz", 20000); } public void service2(object sender, xxxxx.demanderSubmitReportCompletedEventArgs e) { string a = e.Result; } I'm trying to call a windows workflow foundation published as a web service from a Silverlight project. When I call it from a console application it works fine because I can add a web reference then I just make an instance of that webservice then I invoke the method I want. The problem is in the silverlight project cause i can just add a service reference so I find myself working with soap stuff that doesn't work at all, and here is the code error: here is the code:i change it a litle bit in english Error in exécution Microsoft JScript: Unhandled Error in Silverlight Application exception happened in the operation, résult not valide. Consult InnerException for more information. in System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() in AEDSilverlightIntegrated.ServiceReference2.demanderSubmitReportCompletedEventArgs.get_Result() in AEDSilverlightIntegrated.SilverEntryAedHeaderNew.mmm_demanderSubmitReportCompleted(Object sender, demanderSubmitReportCompletedEventArgs e) in AEDSilverlightIntegrated.ServiceReference2.Workflow1_WebServiceSoapClient.OndemanderSubmitReportCompleted(Object state)

    Read the article

  • Context menu for loaded SWF

    - by Palantar
    I have a Flex app with a viewport that loads a series of other swfs. I would like to place a context menu over top of the SWFs when the user right-clicks. To that end, I have set up a fairly standard context menu where each item has a ContextMenuEvent.MENU_ITEM_SELECT event handler. One problem: The eventHandler never gets called. If I place the context-menu code anywhere else in the app, i.e. not on top of a loaded SWF, everything works fine. However, when I place the exact same code on the SWF viewport, the context menu items appear, but the eventHandlers are never called. Any ideas?

    Read the article

  • Process.Exited event is not be called

    - by liys
    Hi all, I have the following code snippet to call into command line: p = new Process(); ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = "cmd.exe"; psi.Arguments = "/C " + "type " + “[abc].pdf”; psi.UseShellExecute = false; psi.RedirectStandardInput = false; psi.RedirectStandardOutput = true; psi.CreateNoWindow = true; p.StartInfo = psi; p.EnableRaisingEvents = true; p.Exited += new EventHandler(p_Exited); p.Start(); p.WaitForExit(); Strangely, When [abc] is a small pdf file(8kb) p_Exited is called. But when it's a large pdf file(120kb) it is never called. Any clues? Thanks,

    Read the article

  • How can I add an event handler to an event by name?

    - by cyclotis04
    I'm attempting to add an event handler for every control on my form. The form is a simple info box which pops up, and clicking anywhere on it does the same thing (sort of like Outlook's email notifier.) To do this, I've written a recursive method to add a MouseClick handler to each control, as follows: private void AddMouseClickHandler(Control control, MouseEventHandler handler) { control.MouseClick += handler; foreach (Control subControl in control.Controls) AddMouseClickHandler(subControl, handler); } However, if I wanted to add a handler for all of the MouseDown and MouseUp events, I'd have to write two more methods. I'm sure there's a way around this, but I can't find it. I want a method like: private void AddRecursiveHandler(Control control, Event event, EventHandler handler) { control.event += handler; foreach (Control subControl in control.Controls) AddRecursiveHandler(subControl, event, handler); }

    Read the article

  • What is the best strategy for populating a TableView from a service?

    - by alrutherford
    I have an application which has a potentially long running background process. I want this process to populate a TableView as results objects are generated. The results objects are added to an observableList and have properties which are bound to the columns in the usual fashion for JavaFX. As an example of this consider the following sample code Main Application import java.util.LinkedList; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class DataViewTest extends Application { private TableView<ServiceResult> dataTable = new TableView<ServiceResult>(); private ObservableList<ServiceResult> observableList; private ResultService resultService; public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { observableList = FXCollections.observableArrayList(new LinkedList<ServiceResult>()); resultService = new ResultService(observableList); Button refreshBtn = new Button("Update"); refreshBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { observableList.clear(); resultService.reset(); resultService.start(); } }); TableColumn<ServiceResult, String> nameCol = new TableColumn<ServiceResult, String>("Value"); nameCol.setCellValueFactory(new PropertyValueFactory<ServiceResult, String>("value")); nameCol.setPrefWidth(200); dataTable.getColumns().setAll(nameCol); // productTable.getItems().addAll(products); dataTable.setItems(observableList); Scene scene = new Scene(new Group()); stage.setTitle("Table View Sample"); stage.setWidth(300); stage.setHeight(500); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(refreshBtn, dataTable); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); } } Service public class ResultService extends Service<Void> { public static final int ITEM_COUNT = 100; private ObservableList<ServiceResult> observableList; /** * Construct service. * */ public ResultService(ObservableList<ServiceResult> observableList) { this.observableList = observableList; } @Override protected Task<Void> createTask() { return new Task<Void>() { @Override protected Void call() throws Exception { process(); return null; } }; } public void process() { for (int i = 0; i < ITEM_COUNT; i++) { observableList.add(new ServiceResult(i)); } } } Data public class ServiceResult { private IntegerProperty valueProperty; /** * Construct property object. * */ public ServiceResult(int value) { valueProperty = new SimpleIntegerProperty(); setValue(value); } public int getValue() { return valueProperty.get(); } public void setValue(int value) { this.valueProperty.set(value); } public IntegerProperty valueProperty() { return valueProperty; } } Both the service and the TableView share a reference to the observable list? Is this good practise in JavaFx and if not what is the correct strategy? If you hit the the 'Update' button the list will not always refresh to the ITEM_COUNT length. I believe this is because the observableList.clear() is interfering with the update which is running in the background thread. Can anyone shed some light on this?

    Read the article

  • siverlight and windows workflow foundation

    - by wissem
    private void btnUpdate_Click(object sender, RoutedEventArgs e) { xxxxxxx.Workflow1_WebServiceSoapClient zer = new xxxxx.Workflow1_WebServiceSoapClient(); zer.demanderSubmitReportCompleted += new EventHandler<xxxxxxxxxxxxxxx.demanderSubmitReportCompletedEventArgs>(service2); zer.demanderSubmitReportAsync("zzz", 20000); } public void service2(object sender, xxxxx.demanderSubmitReportCompletedEventArgs e) { string a = e.Result; } I'm trying to call a windows workflow foundation published as a web service from a Silverlight project. When I call it from a console application it works fine because I can add a web reference then I just make an instance of that webservice then I invoke the method I want. The problem is in the silverlight project cause i can just add a service reference so I find myself working with soap stuff that doesn't work at all, and here is the code error: here is the code error:i change it a litle bit in english Error in exécution Microsoft JScript: Unhandled Error in Silverlight Application exception happened in the operation, résult not valide. Consult InnerException for more information. in System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() in AEDSilverlightIntegrated.ServiceReference2.demanderSubmitReportCompletedEventArgs.get_Result() in AEDSilverlightIntegrated.SilverEntryAedHeaderNew.mmm_demanderSubmitReportCompleted(Object sender, demanderSubmitReportCompletedEventArgs e) in AEDSilverlightIntegrated.ServiceReference2.Workflow1_WebServiceSoapClient.OndemanderSubmitReportCompleted(Object state)

    Read the article

  • Convert an interface's event from VB.Net to C#

    - by Jules
    Hi, I'm struggling to convert the below code to C#. Class Class1 Implements IMyInterface Public Event MyEvent(ByVal sender As Object, ByVal e As MyEventArgs) Implements IMyInterface.MyEvent Public Sub New() AddHandler Me.Slider.ValueChanged, AddressOf OnSliderValueChanged End Sub Private Sub OnSliderValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) RaiseEvent MyEvent(Me, New MyEventArgs()) End Sub End Class Here's what visual studio inserts when I ask it to implement for me: event EventHandler<MyEventArgs> IMyInterface.MyEvent { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } With a bit of googling I'm sure I can find out what to replace the NotImplementedException parts with but VS is still telling me that the definition is not implemented anyway.

    Read the article

  • Attach to Property's setter

    - by StupidDeveloper
    I haven't found similiar post so I'm asking this. Let's say I defined somewhere an application wide available static Property (I mean it's not local) and in one class I would like to know when this property is being changed. Apart from aop (transparentproxy etc.) which I think doesn't suit me well here (and I can't add that to project anyway), what are the options here? One solution I can think of, which is probably a very nasty one, is to use some event that would be executed in the setter and just attach it in the class(es) which needs that. Something like: public static event EventHandler CurrentNumberChanged= delegate {}; public static int CurrentNumber { get { return currentNumber; } set { currentNumber = value; CurrentNumberChanged(null, EventArgs.Empty); } } I know it's really unsafe to use such events ( read here ). And since I would use it in asp.net makes it even more ugly. Do you have any advices ?

    Read the article

  • passing paramter as to webservcie function in wcf

    - by prince23
    hi, this my datagrid event here i am calling the webservice. private void dgProject_RowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e) { WSDataServiceClient wsService = new WSDataServiceClient(); wsService.GetProjectCompleted += new EventHandler<GetProjectCompletedEventArgs>(wsService_GetProjectCompleted); wsService.GetProjectAsync(strUniqueName); // here can i send datagrid as an parameter to the function? Datagrid gd= new Datagrid(); } void wsService_GetProjectCompleted(object sender, GetProjectCompletedEventArgs e) { // } is there any way that i can send datagrid as a paramter to this function is it possiable to do? beacuse i will be using the same websevice function her but need to bind result with different datagrid based on the condition if i can send a datagrid as paramter to this function i can reduce the code so any help on this issue would be great thank you.

    Read the article

  • page_load another handler?

    - by joe doe
    can someone please explain why this code is not working as expected: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class temp : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Response.Write("foo<br>"); this.Load += new EventHandler(temp_Load); } void temp_Load(object sender, EventArgs e) { Response.Write("bar<br>"); Response.End(); } } trying to add another handler for page Load event so that output would be: foo<br> bar<br>

    Read the article

  • Mvp View knows Model

    - by userbb
    I'm trying to use MVP and I notice that my View must know Model that should not happen in MVP I presume. here is example: public partial class TestForm : Form, ITestPresenter { public void LoadList(IEnumerable<AppSignature> data) { testPresenterBindingSource.DataSource = data; } } public interface ITestPresenter { event EventHandler<EventArgs> Load; void LoadList(IEnumerable<AppSignature> data); } and the problem is that in TestForm I need reference to AppSignature. In all tutorials I saw, there are some simple examples like public void LoadList(IEnumerable<String> data) where there is no need reference to model. But how i.e DataGridView can publish current row data?

    Read the article

  • Problem with anonymouse delegate within foreach

    - by geting
    public Form1() { InitializeComponent(); Collection<Test> tests = new Collection<Test>(); tests.Add(new Test("test1")); tests.Add(new Test("test2")); foreach (Test test in tests) { Button button = new Button(); button.Text = test.name; button.Click+=new EventHandler((object obj, EventArgs arg)=>{ this.CreateTest(test); }); this.flowLayoutPanel1.Controls.Add(button); } } public void CreateTest(Test test) { MessageBox.Show(test.name); } } when i click the button witch text is 'test1', the messagebox will show 'test2',but my expect is 'test1'. So ,would anyone please tell me why or what`s wrong with my code.

    Read the article

  • Java vs C# - AddActionListener vs event subscription

    - by S.O.
    Very simple question from one somewhat new to Java: when adding an event handler (or whatever it is called in Java) to a Control, MUST it be an object? I mean, in C# I can do control.event += System.eventHandler(methodThatHandlesEvent) Sure, that's because we have delegate types in C#, but I was wondering if I can choose which method would be called when an event is raised in Java? I mean, in Java I can have something like control.AddActionListener(objectWhichClassImplementsActionListener) And then I have the stupid actionPerformed method in this class, which is the only method that is called. I know, there are more kinds of listeners, but I can't have a "ActionListenerHandler" class in which I implement several actionPerformed methods that can be assigned to different controls?

    Read the article

  • How to measure how long is a function running?

    - by rhose87
    I want to see how long a function is running. So I added a timer object on my form and I came out with this code: private int counter = 0; //inside button click I have: timer = new Timer(); timer.Tick += new EventHandler(timer_Tick); timer.Start(); Result result = new Result(); result = new GeneticAlgorithms().TabuSearch(parametersTabu, functia); timer.Stop(); and: private void timer_Tick(object sender, EventArgs e) { counter++; btnTabuSearch.Text = counter.ToString(); } But this is not counting anything. Any ideas?

    Read the article

  • Function to register functions to be called if event invoked.

    - by zaidwaqi
    Hi, I have a Panel which contains 20 PictureBox controls. If a user clicks on any of the controls, I want a method within the Panel to be called. How do I do this? public class MyPanel : Panel { public MyPanel() { for(int i = 0; i < 20; i++) { Controls.Add(new PictureBox()); } } // DOESN'T WORK. // function to register functions to be called if the pictureboxes are clicked. public void RegisterFunction( <function pointer> func ) { foreach ( Control c in Controls ) { c.Click += new EventHandler( func ); } } } How do I implement RegisterFunction()? Also, if there are cool C# features that can make the code more elegant, please share. Thanks.

    Read the article

  • Problem on style a button

    - by BTGMarco
    Hello i am new on Silverlight, i tring to make a base for a button and that button will change the central image accoring to the situation, however some parts will continue the same, for this reason i make a UserControl and i call that user Control from the code and add to the grid that i need. But this Usercontrol that i am trying to add have a style pre-defined and i don´t geted how i change de image background. Here are the code that i am using; ModelsBase teste = new ModelsBase(); Image img = new Image(); img.Source = new BitmapImage(new Uri("../../Images/person.png", UriKind.RelativeOrAbsolute)); img.Stretch = Stretch.Fill;img.ImageOpened += new EventHandler<RoutedEventArgs>(img_ImageOpened); img.Height = img.Width = 128; teste.Conteudo.HorizontalAlignment = HorizontalAlignment.Left; this.ContentModels.Children.Add(teste); The envent img_ImageOpened is called so the image is loaded, but not is displayed. Sorry for bad english If someone find out where is the problem, please aswer

    Read the article

  • Check for new mails in Hotmail using OpenPop.NET

    - by deadlock
    I was advised to use OpenPop lib to fetch my mail from hotmail. But I could'nt find any better way to check for new mail except disconnecting and reconnecting again. And there, I found a problem, Hotmail doesn't allow more than 1 pop3 login each 15 minutes. I want to know if it's possible to get the new mail without disconnecting and reconnecting to their pop3 server. Here is my code: Timer checker = new Timer(); checker.Interval = 1000; checker.Tick += new EventHandler(delegate { Pop3Client client = new Pop3Client(); client.Connect("pop3.live.com", 995, true); client.Authenticate("[email protected]", "myPassword"); label1.Text = client.GetMessageCount().ToString(); client.Disconnect(); }); checker.Start();

    Read the article

  • How listview delete data in database

    - by Bud33
    I have a problem to delete data in listview, I was able to delete data in listview select record, but data which selected is not deleted in the database, I have a source code Private _updateinputalltrans As Boolean Private Sub btndelete_Click(sender As System.Object, e As System.EventArgs) Handles btndelete.Click With Me.listviewpos.SelectedItem .Remove() End With MessageBox.Show("Are you sure delete this record?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, New EventHandler(AddressOf DeleteData)) End Sub Private Sub DeleteData(ByVal sender As Object, ByVal e As EventArgs) Dim conn As New Connection(Connectiondb) If Me.updateinputalltrans = False Then If Me.listviewpos.Items.Count > 0 Then For Each del As ListViewItem In listviewpos.Items conn.delete_dtpospart(del.Text) Next End If End If End Sub delete_dtpospart a declare which connection to the database using a stored procedure

    Read the article

  • Method to register method to be called when event is raised

    - by zaidwaqi
    I have a Panel which contains 20 PictureBox controls. If a user clicks on any of the controls, I want a method within the Panel to be called. How do I do this? public class MyPanel : Panel { public MyPanel() { for(int i = 0; i < 20; i++) { Controls.Add(new PictureBox()); } } // DOESN'T WORK. // function to register functions to be called if the pictureboxes are clicked. public void RegisterFunction( <function pointer> func ) { foreach ( Control c in Controls ) { c.Click += new EventHandler( func ); } } } How do I implement RegisterFunction()? Also, if there are cool C# features that can make the code more elegant, please share.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >