Search Results

Search found 4334 results on 174 pages for 'sender'.

Page 99/174 | < Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >

  • C# Async call garbage collection

    - by Troy
    Hello. I am working on a Silverlight/WCF application and of course have numerous async calls throughout the Silverlight program. I was wondering on how is the best way to handle the creation of the client classes and subscribing. Specifically, if I subscribe to an event in a method, after it returns does it fall out of scope? internal MyClass { public void OnMyButtonClicked() { var wcfClient = new WcfClient(); wcfClient.SomeMethodFinished += OnMethodCompleted; wcfClient.SomeMethodAsync(); } private void OnMethodCompleted(object sender, EventArgs args) { //Do something with the result //After this method does the subscription to the event //fall out of scope for garbage collection? } } Will I run into problems if I call the function again and create another subscription? Thanks in advance to anyone who responds.

    Read the article

  • How to programmatically set a data cell of database in VB.Net?

    - by manuel
    I have a Microsoft Access database file connected to VB.NET. In the database table, I have a 'No.' and a 'Status' column. Then I have a textbox where I can input an integer. I also have a button, which will change the data cell in 'Status' where 'No.' = textbox.Text(), when I click it. Let's say I want the 'Status' cell to be changed to "Low". What codes should I put in the button_Click event handler? Here is the codes I used to retrieve and display the database table. Public Class theForm Dim con As New OleDb.OleDbConnection Dim ds As New DataSet Dim daTitles As OleDb.OleDbDataAdapter Private Sub theForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=|DataDirectory|\db1.mdb" con.Open() daTitles = New OleDb.OleDbDataAdapter("SELECT * FROM Titles", con) daTitles.Fill(ds, "Titles") DataGridView1.DataSource = ds.Tables("Titles") DataGridView1.AutoResizeColumns() End Sub

    Read the article

  • How can I bind a custom property of a windows form to a second property?

    - by jeroko
    I want to bind a custom property of a windows form to a second property, so when I update the former the latter gets the same value. This is the simplest example of what I'm trying to do: public partial class Form2 : Form { public string MyTargetProperty { get; set; } public string OtherProperty { get; set; } public Form2() { InitializeComponent(); this.DataBindings.Add("MyTargetProperty", this, "OtherProperty"); } private void button1_Click(object sender, EventArgs e) { MyTargetProperty = "test"; Console.WriteLine("OtherProperty " + OtherProperty); } } When I click button1 I should be able to see that 'OtherProperty' has the same value as 'MyTargetProperty'. Am I doing something wrong? Do I miss something?

    Read the article

  • how to write silverlight threading function in another file or project

    - by Piyush
    I am using three tier architecture.I have SilverlightUI and UIController two projects.SilverlightUI contains only UI pages and controls while UIController contains all proxies of WCF services. Now I have created threads to update my controls dynamically and to do processing parallel.AS the requirement I want to define all functionality of threads in UIController projects.What should I do? Currenty what I am doing - private void Button_Click(object sender, RoutedEventArgs e) { StartThreads(); } private void StartThreads() { private Thread _thread1; _thread1 = new Thread(DoThread1); _thread1.Start(); } public static void DoThread1() { _data1.Dispatcher.BeginInvoke(delegate() { _data1.Text = _count1.ToString(); }); System.Threading.Thread.Sleep(1000); } I Want to write DoThread1() method in UIController project and call that function from here button_click()

    Read the article

  • Filter the datagridview column based on the current row of another column in C#

    - by user286546
    I have a datagridview that is populating columns from different table. I want to filter the column based on another column of the current row. I tried to use the cell enter event of the datagridview and then filtered the column by filtering the binding source on the column of the current row. private void lINKDataGridView_CellEnter(object sender, DataGridViewCellEventArgs e) { this.pROBLEMBindingSource.Filter = "item_id = " + this.lINKDataGridView.Rows[e.RowIndex].Cells[dataGridViewTextBoxColumn4.Index].Value + ""; } This is how I am filtering the "problem " binding source on the cell enter event of the datagridview . It is working fine but I am getting an error- being: System.ArgumentException: DataGridViewComboBoxCell value is not valid. Any suggestion

    Read the article

  • Better way to kill a Form after the FormClosing event is overridden to hide rather than close?

    - by Paul Sasik
    I have a simple Windows Form that hosts property controls at runtime. To keep the window and its contents alive rather than killing it by handling the FormClosing event, cancel the event and simply hide the form. That's fine but at close of the application I need to actually close the window. I implemented the below but it feels kludgey. Is there a simpler, more clever way to handle this situation? (The form's controller calls KillForm explicitly after it receives a closing event from the main window.) Friend Class HostForm Private _hideInsteadOfClosing As Boolean = True Private Sub HostForm_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) _ Handles Me.FormClosing If _hideInsteadOfClosing Then Me.Hide() e.Cancel = True End If End Sub Public Sub KillForm() _hideInsteadOfClosing = False Me.Close() End Sub End Class

    Read the article

  • Using Cases to change background colour | Visual Studio 2008

    - by Simon
    I really need help working with cases, I'm only learning it so far, but just can't get a drop down menu to work that would change the background of a Textbox. Private Sub cbColours_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbColours.SelectedIndexChanged Select Case colours Case Is = "Red" txtSpace.BackColor = Color.Red Case Is = "Blue" txtSpace.BackColor = Color.Blue Case Is = "Green" txtSpace.BackColor = Color.Green End Select End Sub It isn't doing anything at all... In the dropdown menu, it has Red, Blue and Green one per line When the value (e.g. Green) is clicked, it will then change the Textbox to the colour selected. Many help appreciated :)

    Read the article

  • Getting data from a ListView into an array

    - by Joe
    I have a ListView control on my form set up like this in details mode: What I would like to do, is get all the values of the data cells when the user presses the Delete booking button. So using the above example, my array would be filled with this data: values(0) = "asd" values(1) = "BS1" values(2) = "asd" values(3) = "21/04/2010" values(4) = "2" This is my code so far: Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim items As ListView.SelectedListViewItemCollection = _ Me.ManageList.SelectedItems Dim item As ListViewItem Dim values(0 To 4) As String Dim i As Integer = 0 For Each item In items values(i) = item.SubItems(i).Text i = i + 1 Next End Sub But only values(0) gets filled with the first data cell of the selection (in this case "asd") and the rest of the array entries are blank. I have confirmed this with a breakpoint and checked the array entries myself. I'm REALLY lost on this, and have been trying for about an hour now. Any help would be appreciated, thanks :) Also please note that there can only be one row selection at once. Thanks.

    Read the article

  • How to populate gridview on button_click after searching from access database?

    - by Usman
    I am creating a form in c#.net . I want to populate the gridview only on button click with entries meeting search criteria. I have tried but on searching ID it works but on searching FirstName it gives error plz check SQL also. My Code behind private void button1_Click(object sender, EventArgs e) { try { string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=L:/New project/Project/Project/Data.accdb"; string sql = "SELECT * FROM AddressBook WHERE FirstName='" + textBox1.Text.ToString(); OleDbConnection connection = new OleDbConnection(strConn); OleDbDataAdapter dataadapter = new OleDbDataAdapter(sql, connection); DataSet ds = new DataSet(); connection.Open(); dataadapter.Fill(ds, "AddressBook"); connection.Close(); dataGridView1.DataSource = ds; dataGridView1.DataMember = "AddressBook"; } catch (System.Exception err) { this.label27.Visible = true; this.label27.Text = err.Message.ToString(); } }

    Read the article

  • Any good way to set the exit status of a Cocoa application?

    - by buglesareking
    I have a Cocoa app which interacts with a server and displays a GUI. If there is a fatal error, I display an alert and exit. I'd like to set the exit status to a non-zero value to reflect that an error occurred, for ease of interaction with some other UNIX based tools. Unfortunately I've been unable to find a good way to do so - NSApplication doesn't seem to have any way to set an exit status. At the moment, I've subclassed NSApplication and added an exitStatus ivar (which I set in my app delegate when necessary), then overridden -terminate: so that it calls exit(exitStatus). This works fine, but it seems a bit grungy to me, not to mention that I may be missing something important that the stadnard `terminate: is doing behind the scenes. I can't call [super terminate:sender] in my subclassed method, because that exit()s without giving me a chance to set the status. Am I missing something obvious?

    Read the article

  • how to modify a textbox using remoting

    - by danutz0119
    I am trying to modify a textBox found in the server Form using remoting from the client side. i have tried some solutions i found, but none of them work. the remoting part works propperly, the only thing that I am not able to figure out is this: this is what i have: client side: ... private void btn_b1_Click(object sender, EventArgs e) { ... myFunc.update(string s); ... } ... sharedLibs: public interface myInterf { void update(string s); } server side: here i have 2 classes in the same namespace class class1 : MarshalByRefObject, myInterf { public void update(string s) { //what do i write here to modify textBox1? } } public partial class class2 : Form { ... // here is the textBox i am trying to alter; }

    Read the article

  • Possible relationship between PHP Mailer and Mailer-Daemon

    - by XGreen
    Hi, I am using the PHPMailer Class from a website which sends confirmation of the user ajax upload to my client. This uses the mail.myclient.com SMTP Host. This is the same SMTP Host that my client uses for his outlook to check his emails. This email from the website gets sent without errors although I have received two emails from my client regarding Mail delivery failed: returning message to sender for the same address I have used to send confirmation emails out from. Can these two issues be related? Do I need to provide more info? Thanks a bunch!

    Read the article

  • Set a js variable in a html include

    - by user102533
    I have a ASP.NET page that uses the include method for header. I am adding a JS variable that I access from JS functions In head.htm <script language="javascript" type="text/javascript"> var render=<%= RenderProperty %>; </script> The RenderProperty is a method in the base page class (a .cs file that inherits from System.Web.UI.Page) It looks something like this: private bool _renderProp = false; public bool RenderProperty { get { return _renderProp; } set { _renderProp = value; } } On a page by page basis, I set the RenderProperty in the Page_Load of a aspx page protected void Page_Load(object sender, EventArgs e) { RenderProperty = true; } I get a compile time error that says: The name 'RenderProperty' does not exist in the current context C:\...\head.htm

    Read the article

  • Simple question C#.net about if else statement

    - by ilkdrl
    Iam doing a simple website and when i press button, i should see weight in label.. i see but if text.maxlenght 6, i should see ERROR message in same label but repeat see weight in label. How can i solve this problem? protected void Button1_Click(object sender, EventArgs e) { double sayi1, sayi2, sayi3, hesap, sonuc; sayi1 = Convert.ToDouble(Tb1.Text); sayi2 = Convert.ToDouble(Tb2.Text); sayi3 = Convert.ToDouble(Tb3.Text); if (Tb1.MaxLength > 6 || Tb2.MaxLength > 6) { lbl1.Text = "ERROR."; } else { hesap = (((sayi1 - ((sayi1 - sayi2) / 2)) * ((sayi1 - sayi2) / 2)) / 40); sonuc = (hesap * sayi3) / 100; lbl1.Text = sonuc.ToString() + "kg"; } }

    Read the article

  • How to make a cell of TAdvStringGrid editable?

    - by ammu
    I am trying to implement a filter using the component TAdvStringGrid. My requirement is that I want the first row of this component to be editable when double clicked, so that the user can filter data. Borland C++ Builder is used to help achieve this task. I found this event OnCanEditCell. TCanEditCellEvent = procedure (Sender:TObject;Arow,Acol:longint;var canedit:boolean) of object; Within this function I've set canedit = true. This doesn't seem to work. Probably I need to do something more. I am new to Windows and GUI development. So any help would be great. Do I need to call this function from the OnDblClickCell event? How can I get it working? Thanks in advance

    Read the article

  • Is there a way in CXF to disable the SoapCompressed header for debugging purposes?

    - by Don Branson
    I'm watching CXF service traffic using DonsProxy, and the CXF client sends an HTTP header "SoapCompressed": HttpHeadSubscriber starting... Sender is CLIENT at 127.0.0.1:2680 Packet ID:0-1 POST /yada/yada HTTP/1.1 Content-Type: text/xml; charset=UTF-8 SoapCompressed: true Accept-Encoding: gzip,gzip;q=1.0, identity; q=0.5, *;q=0 SOAPAction: "" Accept: */* User-Agent: Apache CXF 2.2 Cache-Control: no-cache Pragma: no-cache Host: localhost:9090 Connection: keep-alive Transfer-Encoding: chunked I'd like to turn SoapCompressed off in my dev environment so that I can see the SOAP on the wire. I've searched Google and grepped the CXF source code, but don't see anything in the docs or code that reference this. Any idea how to make the client send "SoapCompressed: off" instead, without routing it through Apache HTTPD or the like? Is there a way to configure it at the CXF client, in other words?

    Read the article

  • How to By Pass Request Validation

    - by GIbboK
    Hi, I have a GridView and I need update some data inserting HTML CODE; I would need this data been stored encoded and decoded on request. I cannot in any way disable globally "Request Validation" and not even at Page Level, so I would need a solution to disable "Request Validation" at Control Level. At the moment I am using a script which should Html.Encode every value being update, butt seems that "Request Validation" start its job before event RowUpdating, so I get the Error "Page A potentially dangerous Request.Form ... ". Any idea how to solve it? Thanks protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { foreach (DictionaryEntry entry in e.NewValues) { e.NewValues[entry.Key] = Server.HtmlEncode(entry.Value.ToString()); } PS I USE Wweb Controls not MVC

    Read the article

  • Add HTML Id's to tags in .aspx file

    - by slandau
    So I'm writing an app that lets the user select a folder, it gets all the .aspx files in that folder, and lets the users check off which ones they want to add HTML ID's to. Then they click start, and this runs private void btnStart_Click(object sender, EventArgs e) { for (int i = 0; i < listFiles.CheckedItems.Count; i++) { } } It loops through all the selected file names. How do I open each of these .aspx files in the background, and go through them and add the id="thisItemId" attribute to each tag that's like a , , , , , etc....

    Read the article

  • Help needed to convert code from C# to Python.

    - by Ali
    Can you please convert this code from C# to Python to be run on IronPython? I don’t have any experience with Python. using System; using Baz; namespace ConsoleApplication { class Program { static void Main() { Portal foo = new Portal("Foo"); Agent bar = new Agent("Bar"); foo.Connect("127.0.0.1", 1234); foo.Add(bar); bar.Ready += new Agent.ReadyHandler(bar_Ready); } static void bar_Ready(object sender, string msg) { Console.WriteLine(msg.body); } } }

    Read the article

  • Where should document-related actions for a Cocoa app be implemented?

    - by Adam Preble
    I'm writing a document-based Cocoa app that's basically a graphical editing program. I want the user to be able to show/hide non-modal windows (such as an inspector window). Since these windows would be shown/hidden from menu items, where is the "best" place to implement the actions, such as - (IBAction)toggleInspector:(id)sender? I've seen that in the Sketch example code these are implemented in the app delegate, and the window controller instances are kept there as well, but that feels like more of a convenient place to put it than the most "graceful" place. Additionally, since this inspector would only be relevant when a document is open it feels like it should be associated more with the document's main NSWindowController than the app.

    Read the article

  • How to do client callback for each item in a foreach statement using c#?

    - by Mike108
    I want to show each item Id that is doing now dynamically in a foreach statement. How to do some kind of client callback to show the item Id in a foreach statement? <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> . protected void Button1_Click(object sender, EventArgs e) { List<int> list = new List<int>() { 1,2,3,4,5 }; foreach (var item in list) { Label1.Text = string.Format("I'm doing item {0} now.", item.ToString()); Page.RegisterStartupScript("", string.Format("<script>alert('doing item {0} now')</script>", item.ToString())); Thread.Sleep(1 * 1000); } }

    Read the article

  • iphone: repeating a transformation

    - by gonso
    Hi I'm trying to represent a view that rotates on the iphone screen. I have a button and when you press it, the view rotates 180 degrees. My problem is that this only works the first time. Here is the code: -(IBAction) flip:(id)sender{ CGAffineTransform transform; //the transform matrix to be used below //BEGIN ANIMATIONS [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0]; //animate if (flag){ transform = CGAffineTransformMakeRotation( RADIANS(180) ); } else { transform = CGAffineTransformMakeRotation( RADIANS(-180) ); } flag = !flag; transform = CGAffineTransformTranslate(transform, 0, 0); self.mySuview.transform = transform; //COMMIT ANIMATIONS [UIView commitAnimations]; } The first time you click, the view spins alright, but when you click again NOTHING happens. No errors, no changes on the view. What am I missing? Thanks Gonso

    Read the article

  • How to handle Application_BeginRequest using a custom filter in asp.net mvc?

    - by denis_n
    How to handle Application_BeginRequest using a custom filter in asp.net mvc? I want to restore session only for one route (~/my-url). I would be cool, if I could create a custom filter and handle that. protected void Application_BeginRequest(object sender, EventArgs e) { var context = HttpContext.Current; if (string.Equals("~/my-url", context.Request.AppRelativeCurrentExecutionFilePath, StringComparison.OrdinalIgnoreCase)) { string sessionId = context.Request.Form["sessionId"]; if (sessionId != null) { HttpCookie cookie = context.Request.Cookies.Get("ASP.NET_SessionId"); if (cookie == null) { cookie = new HttpCookie("ASP.NET_SessionId"); } cookie.Value = sessionId; context.Request.Cookies.Set(cookie); } }

    Read the article

  • How to determine the timezone that an email was sent from in C#

    - by John Sibly
    Can anyone recommend a way to determine the timezone that an email was sent from in C#? Looking at the header information of an email includes information like: Received: from mail-ew0-f211.google.com (123.85.219.211) by UKExchange (10.1.10.99) with Microsoft SMTP Server id 1.2.345.6; Tue, 13 Apr 2010 14:26:24 +0100 Received: by ewy3 with SMTP id 3so288857ewy.6 for <[email protected]>; Tue, 13 Apr 2010 06:26:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.213.2 with HTTP; Tue, 13 Apr 2010 06:26:23 -0700 (PDT) X-Originating-IP: [83.244.243.210] Date: Tue, 13 Apr 2010 14:26:23 +0100 Received: by 10.103.3.17 with SMTP id f17mr3087878mui.123.1271165183473; Tue, 13 Apr 2010 06:26:23 -0700 (PDT) There are a number of "Received: from" and "Received: by" keys with a date, time and timezone indicated on the end. Which one of these should I attempt to parse? Is this a reliable way to figure out the sender's timezone, or anyone recommend a better way?

    Read the article

  • How can I change what happens when "enter" key is pressed on a DataGridView?

    - by SO give me back my rep
    when I am editing a cell and press enter the next row is automatically selected, I want to stay with the current row... I want to happen nothing except the EndEdit. I have this: private void dtgProductos_CellEndEdit(object sender, DataGridViewCellEventArgs e) { dtgProductos[e.ColumnIndex, e.RowIndex].Selected = true; //this line is not working var index = dtgProductos.SelectedRows[0].Cells.IndexOf(dtgProductos.SelectedRows[0].Cells[e.ColumnIndex]); switch (index) { case 2: { dtgProductos.SelectedRows[0].Cells[4].Selected = true; dtgProductos.BeginEdit(true); } break; case 4: { dtgProductos.SelectedRows[0].Cells[5].Selected = true; dtgProductos.BeginEdit(true); } break; case 5: { btnAddProduct.Focus(); } break; default: break; } } so when I edit a row that is not the last one I get this error: Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.

    Read the article

< Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >