Search Results

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

Page 108/174 | < Previous Page | 104 105 106 107 108 109 110 111 112 113 114 115  | Next Page >

  • Make a simple animation in winforms using a loop

    - by Michael Quiles
    I need help making this loop to move a label move smoothly across the screen using count for the animation (its required). The labels location is currently in location 0,0 I'd like to make it go in a square right - down - left - back to its original position how can I accomplish this ? please give me an example using my code below. Thank You in advance. private void xAnimeTimer_Tick(object sender, EventArgs e) { int count; this.xAnimTimer.Stop(); for (count = 0; count <= 100; count++) { this.xAnimLabel.Left = count; } for (count = 0; count <= 150; count++) { this.xAnimLabel.Top = count; }

    Read the article

  • VB.NET 2008 Application crashing during Do Loop

    - by RedHaze
    I am writing an application to compare each item on listbox1 to all items on listbox2. If the item is found, then remove it from both lists. The goal is to only have the items that were not found remain on both lists. The problem is, the application just hangs and I never get any results. I looked at my code several times and I cannot figure out what's going on (programming noob I know...). Can anybody help me with this? Code Snippet: Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim a As String Dim b As String Dim y As String For i As Integer = 0 To ListBox1.Items.Count - 1 a = ListBox1.Items(i) y = 1 Do While y = 1 For x As Integer = 0 To ListBox2.Items.Count - 1 b = ListBox2.Items(x) Dim res As Int16 = String.Compare(a, b) If res = 0 Then y = 0 ListBox2.Items.Remove(i) ListBox2.Items.Remove(x) ElseIf x = ListBox1.Items.Count Then Exit Do End If Next Loop Next End Sub

    Read the article

  • Accessing Controls Values Before Finishing Page_Load

    - by userk
    Hi. I'm with a problem and want to know if someone can help me. I'm creating a table with some controls and I want to save all control values in every postback. As the controls are just defined after the page_load, I can't solve my problem this way: object o; protected void Page_Load(object sender, EventArgs e) { o = createObject(); Create_Table(); if (Page.IsPostBack) Save_Data(); } I thought I could execute Save_Data() at the begining of every postback event, but I think that should exist a better way to solve my problem. Thanks.

    Read the article

  • selected index event is not working in dropdown

    - by prince23
    <asp:DropDownList ID="ddlTime" runat="server" CausesValidation="true" AutoPostBack="true" onselectedindexchanged="ddlTime_SelectedIndexChanged"> <asp:ListItem Selected Value = "True">--Select--</asp:ListItem> <asp:ListItem>8.50</asp:ListItem> <asp:ListItem>9.00</asp:ListItem> <asp:ListItem>9.50</asp:ListItem> </asp:DropDownList> I have drop down with the event changing . but when ever i select an value this event is not firing at all protected void ddlTime_SelectedIndexChanged(object sender, EventArgs e) { } What is the issue that is causing here any help would be great thank you

    Read the article

  • CSV file download ignored in ie8/9

    - by JBB
    I have some code in a button click event which gets a csv string from a hidden input and writes it to the response as a CSV file. This work fine in Chrome, Firefox, ie7, ie9 in quirks mode. However it does not work in ie8 or ie9 default. Looking at this in fiddler the csv is being written to the response but the another get request is being made immediately after and the page reloads. No file saving dialog appears. protected void btnCsvHidden_Click(object sender, EventArgs e) { var csv = csvString.Value; var filename = "Reporting"; Response.Clear(); Response.ClearHeaders(); Response.AddHeader("Cache-Control", "no-store, no-cache"); Response.AddHeader("content-disposition", "attachment; filename=\"" + filename + ".csv\""); Response.ContentType = "text/csv"; Response.Write(csv); Response.End(); }

    Read the article

  • embedded wpf textbox does not accept input

    - by pro3carp3
    I put a wpf textbox inside a combobox to allow the user to enter a custom setting. I can read the keypress in the keydown event, but the text in the textbox does not change. What am I missing? <ComboBoxItem Name="GridSizeCustom"> <StackPanel Height="30" Orientation="Horizontal"> <TextBlock Text="Grid Size (8 - 200)" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0" /> <TextBox Name="GridSizeBox" KeyDown="test" Width="50" /> </StackPanel> </ComboBoxItem> I step through this event handler when I press a key, but no change to the textbox text: public void test(Object sender, KeyboardEventArgs e) { int x = 0; } Any help is appreciated. Thanks.

    Read the article

  • Object reference not set to an instance of an object

    - by Ste
    I have this function that create runtime textbox: int i = 0; private TextBox[] addressBox = new TextBox[100]; private void appendNewTab() { addressBox[i] = new TextBox(); addressBox[i].KeyPress += new KeyPressEventHandler(this.addressBox_KeyPress); i++; } void addressBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { MessageBox.Show(addressBox[i].Text); } } but i have Object reference not set to an instance of an object here MessageBox.Show(addressBox[i].Text); any suggestion?

    Read the article

  • How to disable listbox auto select item when pressing key

    - by tomfox66
    I have a listbox where I want to copy and paste items within that listbox. Copy and paste works fine but everytime I press "Crtl + C" the item starting with the letter C is automatically selected. Can this automatic selection be disabled or am I missing something here Here is the copy and paste method I implemented: private void listBox_Script_KeyDown(object sender, KeyEventArgs e) { if (e.Control == true && e.KeyCode == Keys.C) { int test = listBox_Script.SelectedIndex; Clipboard.SetDataObject(listBox_Script.Items[listBox_Script.SelectedIndex], true); return; } if (e.Control == true && e.KeyCode == Keys.V) { if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)) { listBox_Script.Items.Insert(listBox_Script.SelectedIndex + 1, Clipboard.GetDataObject().GetData(DataFormats.Text).ToString()); return; } }

    Read the article

  • How do I use a graphics method to pass parameters? Example is below.

    - by sonny5
    private static void getCorners(out float Wx, out float Wy, out float Vx, out float Vy) { // note-- I don't know how to flip the Y axis using this method... this is not a "graphics" method // In other words, I should use something like: // flipY(object sender, System.EventArgs e); // but don't know the syntax or whatever // I tried to do this: //Graphics g = this.CreateGraphic //Matrix myMatrix2 = new Matrix(1, 0, 0, -1, 0, 0); // flip Y axis //g.Transform = myMatrix2; //g.TranslateTransform(0, 480, MatrixOrder.Append); // ...but I get the error: // error CS0026: Keyword 'this' is not valid in a static property, static method, or // static field initializer Wx = 1.00F; Wy = 1.00F; // make this 1.00 (not 3.00F) down from the TOP since cannot get Y flipped Vx = ((Wx- WXmin)*((VXmax-VXmin)+VXmin)/(WXmax-WXmin)); Vy = ((Wy-WYmin)*(VYmax-VYmin)/(WYmax-WYmin)+VYmin); } thanks, Sonny5

    Read the article

  • Imbedded wpf textbox does not accept input

    - by pro3carp3
    I put a wpf textbox inside a combobox to allow the user to enter a custom setting. I can read the keypress in the keydown event, but the text in the textbox does not change. What am I missing? <ComboBoxItem Name="GridSizeCustom"> <StackPanel Height="30" Orientation="Horizontal"> <TextBlock Text="Grid Size (8 - 200)" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0" /> <TextBox Name="GridSizeBox" KeyDown="test" Width="50" /> </StackPanel> </ComboBoxItem> I step through this event handler when I press a key, but no change to the textbox text: public void test(Object sender, KeyboardEventArgs e) { int x = 0; } Any help is appreciated. Thanks.

    Read the article

  • List with items returns empty

    - by Power-Mosfet
    I have created a simple List function but if I Loop through the List it's empty. It should not be! All, thank you for the input. problem solved // List function public class process_hook { public static List<string> pro_hook = list_all_processes(); protected static List<string> list_all_processes() { var list = new List<string>(); foreach (Process i in Process.GetProcesses(".")) { try { foreach (ProcessModule pm in i.Modules) { list.Add(pm.FileName); } } catch { } } return list; } } // call private void button1_Click(object sender, EventArgs e) { foreach (String _list in process_hook.pro_hook) { Console.WriteLine(_list); } }

    Read the article

  • C# background worker and timer loop

    - by Mike
    This is my first attempt of a Timer, if someone could help me out where I am going wrong it would be awesome. I'm trying to use a while loop where if the timer hits 30 seconds try to loop it again. private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { System.Windows.Forms.Timer my_timer = new System.Windows.Forms.Timer(); my_timer = null; //int restartticker = 30000; while (true) { my_timer.Start(); if (my_timer.Equals(30000)) { watcherprocess1(); } my_timer = null; } } Object reference not set to an instance of an object. my_timer.Start();

    Read the article

  • C#.NET Problem with locking of page after writing stream to window.

    - by godlikeskills
    The code below works fine, the problem is the 1st two lines are appearing on screen. It basically loads the PDF but I can't see the btnAcceptProposal change name or become enabled. Tried a Thread for the load but it broke. Anyone got any ideas - it's a web application protected void btnPDFProposal_Click(object sender, EventArgs e) { btnAcceptProposal.Enabled = true; btnAcceptProposal.Text = "sss"; byte[] p = Order.Proposal; Response.AppendHeader("content-disposition", "attachment; filename=Proposal.pdf"); Response.ContentType = "Application/pdf"; Response.Clear(); Response.BinaryWrite(p); Response.End(); }

    Read the article

  • Question about custom events

    - by Malfist
    I'm making custom events for C# and sometimes it isn't working. This is how I'm making the event happen: private bool isDoorOpen; public bool IsDoorOpen { get { return isDoorOpen;} private set { isDoorOpen = value; DoorsChangeState(this, null);} } And these are the event declarations: //events public delegate void ChangedEventHandler(Elevator sender, EventArgs e); public event ChangedEventHandler PositionChanged; public event ChangedEventHandler DirectionChanged; public event ChangedEventHandler BreaksChangeState; public event ChangedEventHandler DoorsChangeState; This works as long as there are methods attached to the events, but if there isn't, it throws a null ref exception. What am I doing wrong?

    Read the article

  • Hiding dropdown list when list is empty

    - by Amina
    I currently have a dropdown list that is populated on page load and sometimes the dropdown list doesn't contain anything and is empty. I would like the hide the dropdown list whenever there aren't any items in the list. I thought i could do this via javascript but i am not sure what i could be doing wrong because after adding the javascript it stills appear on the page. dropdown select: <select data-bind="options: endReason() ? endReason().SubReasons : [], value: subReasonId, optionsText: 'Text', optionsValue: 'Value', visible: isChecked" name="subReasons"> </select> This is my Javascript: <script type="text/javascript"> function OnClientDropDownOpening(sender, eventArgs) { var combo = $find("<%= subReasons %>"); items = combo.get_items(); if(items.get_count()==0) { eventArgs.set_cancel(true); } } </script>

    Read the article

  • How to set credential persistence permanent on Android

    - by doreamon
    My app has save login credential feature, so I store cookies for the next use after succeeding to sign in. However, after a time period, the session will be time out and cannot log in with the cookies any more. On iOS, after setting credential persistence to permanent, the app works nicely even after restarting the phone: [[challenge sender] useCredential:[NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistencePermanent] forAuthenticationChallenge:challenge]; On Android, I cannot find out such kind of this option. Here is from my HttpHelper class: ((AbstractHttpClient) HttpHelper.client).getAuthSchemes().register("ntlm",new NTLMSchemeFactory()); NTCredentials creds = new NTCredentials(user, pass, "", domain); ((AbstractHttpClient) HttpHelper.client).getCredentialsProvider().setCredentials(AuthScope.ANY, creds); The server is SharePoint so I have to deal with ntlm authentication by following this instruction If you have idea, please let me know. Thank you.

    Read the article

  • An attempt to attach an auto-named database for file failed in Vb.Net

    - by user2454135
    I am Trying to connect database for first time , and I am getting this error : An attempt to attach an auto-named database for file VBTestDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. and getting error on myconnect.Open() Heres my code : Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myconnect As New SqlClient.SqlConnection myconnect.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=VBTestDB.mdf;Integrated Security=True;User Instance=True;" Dim mycommand As SqlClient.SqlCommand = New SqlClient.SqlCommand() mycommand.Connection = myconnect mycommand.CommandText = "INSERT INTO Card (CardNo,Name) VALUES (@cardno,@name)" myconnect.Open() Try mycommand.Parameters.Add("@cardno", SqlDbType.Int).Value = TextBox1.Text mycommand.Parameters.Add("@name", SqlDbType.NVarChar).Value = TextBox2.Text mycommand.ExecuteNonQuery() MsgBox("Success") Catch ex As System.Data.SqlClient.SqlException MsgBox(ex.Message) End Try myconnect.Close() End Sub

    Read the article

  • Cannot convert to string [on hold]

    - by user3598883
    I am trying to transfer information from form1 to form2 and I am getting the error of "Cannot implicitly convert type form1.employee to 'string' Some coding i have used for this transfer process is as follows: (everything is set to public) I'll Also add that I ONLY have it set to FirstName.FirstName because it seems tog et it to work if I remove one one of the FirstName then It tells me it cannot convert to string public void Enter_Click(object sender, EventArgs e) Form2 frm2 = new Form2(); Employee FirstName = new Employee(); if (Directions.Text == "Please Enter Employee First Name") { FirstName.FirstName = Info.Text; Directions.Text = "Please Enter Employee Last Name"; } frm2.FN.Text = FirstName; public class Employee { public string FirstName; }

    Read the article

  • try except block in Delphi

    - by Nik
    Do you guys know a way to trap log and re-raise exception in Delphi code. A simple example: procedure TForm3.Button1Click(Sender: TObject); begin try raise Exception.Create('Bum'); except on E: Exception do begin MyHandleException(E); end; end; end; procedure TForm3.MyHandleException(AException: Exception); begin ShowMessage(AException.Message); // raise AException; - this will access violate end; So I need to re-raise it in the except block but I was wondering is there a better way to write my own method to handle and (on specific conditions) to re-raise exceptions?

    Read the article

  • How to change Session for only one route 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). It 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 i insert values from list of Data Grid View,current time ,EmployeeID using button click event (C

    - by Six fourty
    hi, it show me this error Incorrect syntax near the keyword 'Select' to make to clear Employee ID in this case is FK in the table (Attendance detail) and the other thing is i am using Data Grid View from another table(Employee information) to Show the list of the staff in my form. then i want to transfer each selected cell value from Data Grid View to attendance detail table. 10q private void time_in_Click(object sender, EventArgs e) { employee_InformationDataGridView.SelectedCells[0].Style.ForeColor = Color.Green; time_in.Enabled = false; time_out.Enabled = true; con = new SqlConnection(GlobalClass.conn); con.Open(); SqlCommand cmd = new SqlCommand("Insert into Attendancedetail Values(" + "Select from EmployeeInformation(EmployeeID)" + ",'" + employee_InformationDataGridView.SelectedCells[0] + "','" + DateTime.Now.ToLongDateString() + "','" + null + "','" + null + "','" + DateTime.Now.ToLongTimeString() + "'," + null + ")", con); int i = cmd.ExecuteNonQuery(); MessageBox.Show(i.ToString() + " record inserted"); }

    Read the article

  • I set a global bug catcher in my application for unhandled exceptions and it is picking up all exceptions

    - by user1632018
    I am trying to figure out why this is happing. In my vb.net application I set a global handler in the ApplicationEvents.vb which I thought would only pick up any unhandled exceptions, although it is picking up every exception that happens in my application whether or not they are handled with try catch blocks. Here is my code in applicationevents Private Sub MyApplication_UnhandledException(ByVal _ sender As Object, ByVal e As _ Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) _ Handles Me.UnhandledException e.ExitApplication = _ MessageBox.Show(e.Exception.Message & _ vbCrLf & "The application has encountered a bug, would you like to Continue?", "An Error has occured.", _ MessageBoxButtons.YesNo, _ MessageBoxIcon.Question) _ = DialogResult.No End Sub In the rest of my application I set normal try catch blocks like this: Try Catch ex as exception End Try Can anyone tell me why this is happening?

    Read the article

  • Why won't my movie play using MPMoviePlayerController?

    - by Nosrettap
    I'm trying to get a basic movie to play in an iPhone app; however, I can't seem to get it to work. Here's my entire code: #import <MediaPlayer/MediaPlayer.h> #import "ViewController.h" @implementation ViewController - (IBAction)playMoviePressed:(id)sender { NSURL *url = [NSURL URLWithString:@"http://www.ebookfrenzy.com/ios_book/movie/movie.mov"]; MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; moviePlayer.controlStyle = MPMovieControlStyleDefault; moviePlayer.shouldAutoplay = YES; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES animated:YES]; [moviePlayer prepareToPlay]; [moviePlayer play]; } @end I have one button on screen that calls playMoviePressed when it is tapped. I know that this method is getting called. I have also tried this with .mov and .mp4 local files that I have dragged into xcode.

    Read the article

  • How to increase Size of PhotoLibrary View in iPad?

    - by Shreedhar
    Folwing code is to pop photoLibrary videoPicker = [[UIImagePickerController alloc] init]; videoPicker.delegate = self; videoPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; videoPicker.mediaTypes = [NSArray arrayWithObjects:(NSString *) kUTTypeImage,(NSString *)kUTTypeMovie,nil]; videoPicker.allowsEditing = YES;; pop = [[UIPopoverController alloc]initWithContentViewController:videoPicker]; pop.popoverContentSize = CGSizeMake(500, 900); [pop setDelegate:self]; [pop presentPopoverFromRect:[sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES]; [videoPicker release]; How to increase the photoLibrary view(width X height) on pop?

    Read the article

  • accessing ok.DialogResult inside a function

    - by sayyad
    I am writing function which accepts user input from textbox. Action will take place when ok button is clicked. i made button(DialogResult=OK). code looks like private void canny() { // if (this.DialogResult == DialogResult.OK) { MessageBox.Show("ok"); } //to Do } But I can't see any messagebox. What I am missing. private void ok_Click(object sender, EventArgs e) { // should I add here some thing } Should I add control Form1.Control.Add(Ok)?????????????????? if yes in which part of code. regards,

    Read the article

< Previous Page | 104 105 106 107 108 109 110 111 112 113 114 115  | Next Page >