Search Results

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

Page 105/174 | < Previous Page | 101 102 103 104 105 106 107 108 109 110 111 112  | Next Page >

  • How can I delete video stored in the photo library ?

    - by srikanth rongali
    I have saved video in to the photo library. -(void)exportVideo:(id)sender { NSString *path = [DOCUMENTS_FOLDER stringByAppendingString:@"/air.mp4"]; NSLog(@"Path:%@", path); NSLog(@"Export Button CLicked"); UISaveVideoAtPathToSavedPhotosAlbum(path, self, @selector(video:didFinishSavingWithError: contextInfo:), nil); } - (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo { NSLog(@"Finished saving video with error: %@", error); } Now I need to delete the video i have stored programmatically. How can I delete the video ? Are there any functions for it? Thank You.

    Read the article

  • Event is causing an error, but I can't catch the exception

    - by proudgeekdad
    A developer has created a custom control in ASP.NET using VB.NET. The custom control uses a repeater. In certain scenarios, the rpt_ItemDataBound event is encountering a data error. My goal is rather than having the user see the yellow screen of death, give the user a friendlier error explaining exactly what the data error is. I figured I would be able to use a Try/Catch block as shown below throw the exception, however, it appears that the event has nowhere to be thrown to and stops executing at the "End Try" line. Protected Sub rpt_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rpt1.ItemDataBound, rpt2.ItemDataBound Try ProcessBadData... Catch ex As Exception Throw ex End Try End Sub In VB.NET, I can find where the repeater's DataSource is being set, however, I can not find a DataBind event. Any ideas how I can capture the exception in this ASCX control so I can report it to the user?

    Read the article

  • Hold the command prompt until user close it from close button.

    - by Kasun
    Hi, I going to get the command prompt from my C# application to compile some C++ files. Code is like this. private void button1_Click(object sender, EventArgs e) { string filePath = @"C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe"; System.Diagnostics.Process.Start(filePath); } But After i click the button it suddenly comes and disappear. Even its opening two command prompts. I need to Hold it and only one command prompt should appear. Can some one provide me the necessary codes. Thank you.

    Read the article

  • ASP.Net Problem with View Control

    - by tking
    I admit, I'm an .NET n00b. Basically what I'm trying to do is I have a page with a text box on it and an image button. On click of the image button I want it to show a view control I have set up. Inside this view control is an image and some text. So this is what I have in my code-behind. protected void btnSubmit_Click(object sender, ImageClickEventArgs e) { string email = txtUnsubscribe.Text; vwSuccess.Visible = true; } Simple right? Well when I click on the button for submit, I get the "Object reference not set to an instance of an object." error message. Where am I going wrong?

    Read the article

  • How to Execute Base Class's Method Before Implementors's Method?

    - by DaveDev
    I have the following page public partial class GenericOfflineCommentary : OfflineFactsheetBase { } where OfflineFactsheetBase is defined as public class OfflineFactsheetBase : System.Web.UI.Page { public OfflineFactsheetBase() { this.Load += new EventHandler(this.Page_Load); this.PreInit += new EventHandler(this.Page_PreInit); } protected void Page_PreInit(object sender, EventArgs e) { if (Request.QueryString["data"] != null) { this.PageData = StringCompressor.DecompressString(Request.QueryString["data"]); this.ExtractPageData(); } } } OfflineFactsheetBase has the following virtual method: public virtual void ExtractPageData() { // get stuff relevant to all pages that impmement OfflineFactsheetBase } which is implemented in all pages that impmement OfflineFactsheetBase as follows: public partial class GenericOfflineCommentary : OfflineFactsheetBase { public override void ExtractPageData() { // get stuff relevant to an OfflineCommentary page. } } Currently, only GenericOfflineCommentary's ExtractPageData() is firing. How can I modify this to first run OfflineFactsheetBase's ExtractPageData() and then GenericOfflineCommentary's? edit: I'm trying to avoid having to call base.ExtractPageData() in every implementor. Is this possible?

    Read the article

  • Getting a NullReferenceException Error when invoking a Select File Dialog Box

    - by codingguy3000
    Hey everyone This is a real newbie question. I have simple app that selects a picture and display's that picture in a PictureBox. I decided to mess with the Opacity Attribute so I added a timer and created this cool effect where the Main Form's Opacity is increased by 20% every 400 miliseconds. The problem is that now when I click the button that invokes the Select File Dialog Box I'm getting a NullReferenceException error. private void tmrClock_Tick(object sender, EventArgs e) { if (ViewerForm.ActiveForm.Opacity != 1) { ActiveForm.Opacity = ActiveForm.Opacity + .20; } } The error message is pointing to the if statement. What am I doing wrong? Thanks

    Read the article

  • Using Lambda Statements for Event Handlers

    - by lush
    I currently have a page which is declared as follows: public partial class MyPage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //snip MyButton.Click += (o, i) => { //snip } } } I've only recently moved to .NET 3.5 from 1.1, so I'm used to writing event handlers outside of the Page_Load. My question is; are there any performance drawbacks or pitfalls I should watch out for when using the lambda method for this? I prefer it, as it's certainly more concise, but I do not want to sacrifice performance to use it. Thanks.

    Read the article

  • Why need to call NSTimer again in this code?

    - by Tattat
    - (void) applicationDidFinishLaunching:(UIApplication *)application { //set up main loop [NSTimer scheduledTimerWithTimeInterval:0.033 target:self selector:@selector(gameLoop:) userInfo:nil repeats:NO]; //create instance of the first GameState [self doStateChange:[gsMain class]]; } - (void) gameLoop: (id) sender { [((GameState*)viewController.view) Update]; [((GameState*)viewController.view) Render]; [NSTimer scheduledTimerWithTimeInterval:0.033 target:self selector:@selector(gameLoop:) userInfo:nil repeats:NO]; } This code is from a iPhone game development book. I don't know why the gameLoop method need to call the NSTimer again? in the applicationDidFinishLaunching, it set the NSTimer to do, why don't let it do every 0.033s, why add the same NSTimer code in the gameLoop method? thz.

    Read the article

  • How can I change column fore color in DataGridview as per condition?

    - by Ashish
    hi, i have one table like employee and one of its row is 'status' if status value is 'approve' then i want to show that row in green color and else i want to show it in red color. i have tried following but not working if (e.Row.RowType == DataControlRowType.Header) { string status = DataBinder.Eval(e.Row.DataItem, "IsApprove").ToString(); if (status == "pending") { e.Row.ForeColor = System.Drawing.Color.Red; // Change the row's Text color } } ALSO THIS ONE private void gvleavedetail_cellformatting(object sender, datagridviewcellformattingeventargs e) { // if the column is the artist column, check the // value. if (this.gvleavedetail.columns[e.columnindex].name == "artist") { if (e.value != null) { // check for the string "pink" in the cell. string stringvalue = (string)e.value; stringvalue = stringvalue.tolower(); if (stringvalue == "high") { e.cellstyle.backcolor = color.pink; } } } But in this case i'm getting error for datagridviewcellformattingeventargs I'm using VS2010

    Read the article

  • Index out of bounds exception in c#

    - by Naga
    I have the following code in my program which is throwing index out of bound exception at line yearList.SetValue(years[count], count); protected void invoiceYear_DataBound(object sender, EventArgs e) { //invoiceYear.SelectedItem.Value= GetYearRange(); String[] years = GetYearRange().Split(new char[] { '[', ',', ']',' ' }); ListItem [] yearList = new ListItem[]{}; System.Diagnostics.Debug.WriteLine("years-->" + years.Length); for (int i = 0; i < years.Length; i++) { System.Diagnostics.Debug.WriteLine("years-->" + years.GetValue(i)); } int count = 0; foreach (String str in years) { if (string.IsNullOrEmpty(str)) System.Diagnostics.Debug.WriteLine("empty"); else { yearList.SetValue(years[count], count); count++; } } //System.Diagnostics.Debug.WriteLine("yearList-->" + yearList.GetValue(0)); //invoiceYear.Items.AddRange(yearList); }

    Read the article

  • Whats wrong with this my SELECt Query >?

    - by user559800
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SQLData As New System.Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True") Dim cmdSelect As New System.Data.SqlClient.SqlCommand("SELECT COUNT(*) FROM Table1 WHERE Name =" + TextBox1.Text + " And Last = '" + TextBox2.Text + "'", SQLData) SQLData.Open() If cmdSelect.ExecuteScalar > 0 Then Label1.Text = "Record Found ! " & TextBox1.Text & " " & TextBox2.Text Return End If Label1.Text = "Record Not Found ! " SQLData.Close() End Sub I write this code to find whether the record entered in textbox1 and textbox2 exists or not ..if record exist ..then in label1 the text would be RECORD FOUND else NO RECORD FOUND ERROR : **when i enter in textbox1 and textbox2 then on button click event it shows the error : Invalid column name ,,**

    Read the article

  • how to display the listbox items to a label using VB2008

    - by Cecilia
    I am trying to display listbox items in a label. After debugging,I get the error : " make sure that the maximun index on the list is less than the list size" any comment will be highly appreciate, Private Sub xMultiButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles xMultiButton.Click Dim count As Integer count = Me.xNamesListBox.Items.Count For count = 0 To 3 Me.xResultLabel.Text = Me.xNamesListBox.SelectedItems.Item(0).ToString & ControlChars.NewLine _ & Me.xNamesListBox.SelectedItems.Item(1).ToString & ControlChars.NewLine _ & Me.xNamesListBox.SelectedItems.Item(2).ToString & ControlChars.NewLine _ & Me.xNamesListBox.SelectedItems.Item(3).ToString & ControlChars.NewLine _ & Me.xNamesListBox.SelectedItems.Item(4).ToString Next End Sub

    Read the article

  • Dropdown binding and postbacks - ASP.NET

    - by DotnetDude
    I have a rather complex page. The ASPX page loads a user control which in turn loads a child User control. Parent Control protected override void OnInit(EventArgs e) { //Loads child control } In the child user control, I use custom control that inherits from System.Web.UI.HtmlControls.HtmlSelect ASCX: <cust:CustDropDownList id="ctlDdl" runat="server"/> ASCX.CS protected void Page_Load(object sender, EventArgs e) { //Binds CtlDdl here } When the user clicks on the Save button, the controls get user controls get dynamically reloaded, but Iose the value the user has selected in the dropdown. I run into the chicken and egg problem here. I think I need to bind the ctlDdl only on if its not a postback, but that results in the dropdown not getting populated. If I bind it everytime, then i lose user's selection EDIT: Can someone respond to my comment to Jonathan's answer? Thanks

    Read the article

  • Problematic comboBox Windows Forms

    - by zaidwaqi
    Hi, I use VS2008 C# + Windows Forms. I can't understand why comboBox does not behave the way it should. In Design mode, I added a comboBox to my form, and edit Items to add "A" and "B". Double-clicking brings me to SelectedIndexChanged event, which I edit to display the selected text with MessageBox. private void comboBoxImageSet_SelectedIndexChanged(object sender, EventArgs e) { MessageBox.Show(comboBoxImageSet.SelectedText); } When I run, and select "A" or "B" in the comboBox, the MessageBox appears, but nothing is written. Why? Thanks.

    Read the article

  • How to Execute Base Class's ExtractPageData() Before Implementors's ExtractPageData()?

    - by DaveDev
    I have the following page public partial class GenericOfflineCommentary : OfflineFactsheetBase { } where OfflineFactsheetBase is defined as public class OfflineFactsheetBase : System.Web.UI.Page { public OfflineFactsheetBase() { this.Load += new EventHandler(this.Page_Load); this.PreInit += new EventHandler(this.Page_PreInit); } protected void Page_PreInit(object sender, EventArgs e) { if (Request.QueryString["data"] != null) { this.PageData = StringCompressor.DecompressString(Request.QueryString["data"]); this.ExtractPageData(); } } } OfflineFactsheetBase has the following virtual method: public virtual void ExtractPageData() { // get stuff relevant to all pages that impmement OfflineFactsheetBase } which is implemented in all pages that impmement OfflineFactsheetBase as follows: public partial class GenericOfflineCommentary : OfflineFactsheetBase { public override void ExtractPageData() { // get stuff relevant to an OfflineCommentary page. } } Currently, only GenericOfflineCommentary's ExtractPageData() is firing. How can I modify this to first run OfflineFactsheetBase's ExtractPageData() and then GenericOfflineCommentary's?

    Read the article

  • VB.NET take each letter of a word and display in ListBox

    - by Kaleet
    Private Sub btnWord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWord.Click Dim Inputter As String Dim Words As String = "" Do Inputter = InputBox("Enter word", "Enter Word") If Inputter <> String.Empty Then lstDisplay.Items.Add(Inputter) Word += Inputter.Substring(0, 1) End If Loop Until Inputter <> String.Empty ' SOMETHING GOES HERE!!!!!' lstDisplay.Items.Add("---") lstDisplay.Items.Add(Word) End Sub Here is how it works, when you click the button it displays an input box so for example type in "CAT". But I can't figure out how to get it to do C (newline) A (newline) T (newline) within the listbox. Please help! C A T - CAT

    Read the article

  • ViewState Vs Session ... maintaining object through page lifecycle

    - by Kyle
    Can someone please explain the difference between ViewState and Session? More specifically, I'd like to know the best way to keep an object available (continuously setting members through postbacks) throughout the lifecycle of my page. I currently use Sessions to do this, but I'm not sure if it's the best way. For example: SearchObject searchObject; protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { searchObject = new SearchObject(); Session["searchObject"] = searchObject; } else { searchObject = (SearchObject)Session["searchObject"]; } } that allows me to use my searchObject anywhere else on my page but it's kind of cumbersome as I have to reset my session var if I change any properties etc. I'm thinking there must be a better way to do this so that .NET doesn't re-instantiate the object each time the page loads, but also puts it in the global scope of the Page class? Please advise. TIA

    Read the article

  • Make the Enter key act like the submit button

    - by Michael Quiles
    How can I make it where some one presses the enter key on my form it will submit this code ? Ive tried the ligtning bolt events etc... but I can't seem to figure it out. private void xTripSubmitButton_Click(object sender, EventArgs e) { // Calculates the numbers from the input and output boxes/labels Miles = double.Parse(this.xTripDestinationTextBox.Text); Mpg = double.Parse(this.xTripMpgTextBox.Text); Price = double.Parse(this.xTripPricepgTextBox.Text); Output = Miles / Mpg; Coutput = Output * Price; //displays a message and the result for the numbers the user inputs this.xTripOutputLabel.Text = "Total gallons you would use: " + Output.ToString("0") + Environment.NewLine + "Total amount it will cost you: " + Coutput.ToString("C"); }

    Read the article

  • Explain the code: c# locking feature and threads

    - by Mendy
    I used this pattern in a few projects, (this snipped of code is from CodeCampServer), I understand what it does, but I'm really interesting in an explanation about this pattern. Specifically: Why is the double check of _dependenciesRegistered. Why to use lock (Lock){}. Thanks. public class DependencyRegistrarModule : IHttpModule { private static bool _dependenciesRegistered; private static readonly object Lock = new object(); public void Init(HttpApplication context) { context.BeginRequest += context_BeginRequest; } public void Dispose() { } private static void context_BeginRequest(object sender, EventArgs e) { EnsureDependenciesRegistered(); } private static void EnsureDependenciesRegistered() { if (!_dependenciesRegistered) { lock (Lock) { if (!_dependenciesRegistered) { new DependencyRegistrar().ConfigureOnStartup(); _dependenciesRegistered = true; } } } } }

    Read the article

  • Custom Control Events in C#

    - by pm_2
    I'm trying to create a custom control and need to raise an event from it. The idea is to raise an event at the end of the click event (OnAfterClick). I found one or two tutorials on doing this, but am clearly missing a step somewhere; I have the following. In the control: public class AfterClickEventArgs : EventArgs { ... } public partial class MyButton : CommandButton { public delegate void AfterClickEvnt(object sender, AfterClickEventArgs e); public event AfterClickUpdatedEvnt AfterClick; } protected override void OnClick(EventArgs e) { ... Processing here ... AfterClickEventArgs myArgs = new AfterClickEventArgs(); AfterClick(this, newArgs); } In the program using the control: In InitializeComponent(): this.MyButton.AfterClick += new System.EventHandler(this.cmdMyButton_Click); This line is giving me a compile error (cmdMyButton_Click does exist). It tells me: Cannot implicitly convert type 'System.EventHandler' to 'Namespace.MyButton.AfterClick' Can anyone tell me what I'm missing, or misunderstanding about this, please?

    Read the article

  • Memory leak in chrome.extension.sendRequest()

    - by jprim
    Chrome Version : 9.0.597.19 (Build 68937) beta & current stable I have simplified my code as far as possible. I ended up with the attached extension: content.js (content script run on every site): setInterval(function() { chrome.extension.sendRequest({ }, function(response) { //Do nothing }); }, 1); background.js (background page script): chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { sendResponse({ }); }); When you install this extension, you can observe it eating up memory extremely fast (I got 90MB in 1 min with 9 tabs opened). You can speed up the process by opening more tabs. Of course, the extension I am actually developing does not send requests every millisecond, but only every 3 seconds. This just slows it down, though. A user who has run it in the background for a long time with many tabs opened has reported 100MB of memory usage, and I can reproduce it to a less extreme extent, too.

    Read the article

  • How to close a form in UserControl

    - by FJPoort
    I created a UserControl with the buttons Save, Close and Cancel. I want to close the form without saving on the Cancel button, prompt a message to save on the Close button and Save without closing on the Save button. Normally, I would have used this.Close() on the Cancel button, but the UserControl doesn't have such an option. So I guess I have to set a property for that. Scrolling down the "Questions that may already have your answer" section, I came across this question: How to close a ChildWindow from an UserControl button loaded inside it? I used the following C# code: private void btnCancel_Click(object sender, EventArgs e) { ProjectInfo infoScreen = (ProjectInfo)this.Parent; infoScreen.Close(); } This does the job for one screen, but I wonder if I have to apply this code for all the screen I have? I think there should be a more efficient way. So my question is: Do I need to apply this code for every form I have, or is there another (more efficient) way?

    Read the article

  • MessageBox.Show not raising HelpRequested event

    - by Trevortni
    I have a form that is showing a MessageBox using MessageBox.Show, and trying to receive events from the Help button on the MessageBox so I can execute my own code. The Microsoft documentation shows how to do this; however, using what is suggested does not work. Here's a shortened version of my code: Private Function MethodName() As Boolean AddHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested Select Case MessageBox.Show("Text", "Title", MessageButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, 0, True) Case MsgBoxResult.Yes ' Do stuff Case MsgBoxResult.No ' Do stuff Case MsgBoxResult.Cancel RemoveHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested Return False End Select RemoveHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested End Function Private Sub MsgBoxHelpRequested(ByVal sender As Object, ByVal hlpevent As System.Windows.Forms.HelpEventArgs) ' Breakpoint that never gets hit ' More code End Sub I've been searching for a solution to this problem, but the best I've found is this question: http://stackoverflow.com/questions/2407880/how-to-detect-help-button-press-in-windows-forms-messagebox that refers me back to the same Microsoft code that doesn't seem to be working. Can anybody help me with this? Thank you.

    Read the article

  • Controling the visibility of a Bitmap in .NET

    - by ET
    Hi everyone, I am trying to create this simple application in c#: when the user double clicks on specific location in the form, a little circle will be drawn. By one click, if the current location is marked by a circle - the circle will be removed. I am trying to do this by simply register the MouseDoubleClick and MouseClick events, and to draw the circle from a .bmp file the following way: private void MouseDoubleClick (object sender, MouseEventArgs e) { Graphics g = this.CreateGraphics(); Bitmap myImage = (Bitmap)Bitmap.FromFile("Circle.bmp"); g.DrawImage(myImage, e.X, e.Y); } My problem is that I dont know how to make the circle unvisible when the user clicks its location: I know how to check if the selected location contains a circle (by managing a list of all the locations containig circles...), but I dont know how exactly to delete it. Another question: should I call the method this.CreateGraphics() everytime the user double-clicks a location, as I wrote in my code snippet, or should I call it once on initialization?

    Read the article

  • getting usb com port

    - by I__
    i have this function: private string GetUSBComPort() { string[] sPorts = SerialPort.GetPortNames(); foreach (string port in sPorts) { if (port != "COM1" && port != "COM4") { return port; } } return null; } this function is being called from form load: private void Form1_Load(object sender, EventArgs e) { serialPort1 = new SerialPort(GetUSBComPort()); if (serialPort1.IsOpen) { serialPort1.Close(); } serialPort1.Open(); //ThreadStart myThreadDelegate = new ThreadStart(ReceiveAndOutput); //Thread myThread = new Thread(myThreadDelegate); //myThread.Start(); this.serialPort1.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived); } the function is unfortunately returning null how do i get the com port to which my phone is attached to via USB?

    Read the article

< Previous Page | 101 102 103 104 105 106 107 108 109 110 111 112  | Next Page >