Search Results

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

Page 91/174 | < Previous Page | 87 88 89 90 91 92 93 94 95 96 97 98  | Next Page >

  • Create WPF TextBox that accepts only numbers

    - by Elad
    I would like to create a TextBox that only accepts numeric values, in a specific range. What is the best way to implement such TextBox? I thought about deriving TextBox and to override the validation and coercion of the TextProperty. However, I am not sure how to do this, and I understand that deriving WPF control is generally not recommended. Edit: What I needed was a very basic textbox that filters out all key presses which are not digits. The easiest way to achieve it is to handle the TextBox.PreviewTextInput event: private void textBox_PreviewTextInput(object sender, TextCompositionEventArgs e) { int result; if (!validateStringAsNumber(e.Text,out result,false)) { e.Handled = true; } } (validateStringAsNumber is my function that primarily use Int.TryParse) Some of the suggested solutions are probably better, but for the simple functionality I needed this solution is the easiest and quickest to implement while sufficient for my needs.

    Read the article

  • How to draw a rectangle in WinForm app in the correct location

    - by TooFat
    I have a WinForm app that has an image displayed in a PictureBox that has the added functionality of allowing a user to draw a rectangle on the image by clicking and dragging. The Location, Height and Width of the rectangle are saved to disk. When the image is viewed again I would like to automatically redraw that rectangle in the same position on the image. When I redraw it, however, the Height and Width are fine but the location is always off. The location is being captured in the MouseDown Event like so private void pbSample_MouseDown(object Sender, MouseEventArgs e) { if (SelectMode) { StartLocation.X = e.X; StartLocation.Y = e.Y; //later on these are saved as the location of the rectangle } } And I am redrawing it like so public void DrawSelectedArea(Rectangle rect) { Graphics g = this.PictureBox1.CreateGraphics(); Pen p = new Pen(Brushes.Black); g.DrawRectangle(p, rect); } Given the location from the MouseEventArgs captured during the MouseDown Event how can I calculate the correct location to redraw my rectangle?

    Read the article

  • C# Windows Forms Print Dialog box click OK twice to respond

    - by sbartlett007
    I'm using Visual Studio 2008, .net Framework 3.5 for a Windows forms client-server app that I'm working on. There is a weird bug when I run the program and try to print. The print dialog box opens, but I have to click the OK button twice for it to work. After the second click it works fine, no errors. When I put a breakpoint on: if (result == DialogResult.OK) , the breakpoint doesn't trigger until the second click. Here is the code: private void tbPrint_Click(object sender, EventArgs e) { try { printDialog1.Document = pDoc; DialogResult result = printDialog1.ShowDialog(); if (result == DialogResult.OK) { pDoc.PrinterSettings.PrinterName = printDialog1.PrinterSettings.PrinterName; pDoc.Print(); } ... This is driving me crazy, and I can't see anything else that would interfere with it.

    Read the article

  • Cast ASP type object to HtmlControl

    - by Joris
    Hey'all How do I cast a li dom element as HtmlControl from an ASP type object? I tried it like this: var li = (HtmlControl)sender; I get a InvalidCastException... The thing is, I want to make the li (a tab) clickable, and then update an UpdatePanel... But when I start like this <li id="li" runat="server" onclick="tab2_Click"> FooBar </li> I get an error because the object is not defined... how to cast?

    Read the article

  • Delphi - Using DeviceIoControl passing IOCTL_DISK_GET_LENGTH_INFO to get flash media physical size (Not Partition)

    - by SuicideClutchX2
    Alright this is the result of a couple of other questions. It appears I was doing something wrong with the suggestions and at this point have come up with an error when using the suggested API to get the media size. Those new to my problem I am working at the physical disk level, not within the confines of a partition or file system. Here is the pastebin code for the main unit (Delphi 2009) - http://clutchx2.pastebin.com/iMnq8kSx Here is the application source and executable with a form built to output the status of whats going on - http://www.mediafire.com/?js8e6ci8zrjq0de Its probably easier to use the download, unless your just looking for problems within the code. I will also paste the code here. unit Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TfrmMain = class(TForm) edtDrive: TEdit; lblDrive: TLabel; btnMethod1: TButton; btnMethod2: TButton; lblSpace: TLabel; edtSpace: TEdit; lblFail: TLabel; edtFail: TEdit; lblError: TLabel; edtError: TEdit; procedure btnMethod1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; TDiskExtent = record DiskNumber: Cardinal; StartingOffset: Int64; ExtentLength: Int64; end; DISK_EXTENT = TDiskExtent; PDiskExtent = ^TDiskExtent; TVolumeDiskExtents = record NumberOfDiskExtents: Cardinal; Extents: array[0..0] of TDiskExtent; end; VOLUME_DISK_EXTENTS = TVolumeDiskExtents; PVolumeDiskExtents = ^TVolumeDiskExtents; var frmMain: TfrmMain; const FILE_DEVICE_DISK = $00000007; METHOD_BUFFERED = 0; FILE_ANY_ACCESS = 0; IOCTL_DISK_BASE = FILE_DEVICE_DISK; IOCTL_VOLUME_BASE = DWORD('V'); IOCTL_DISK_GET_LENGTH_INFO = $80070017; IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS = ((IOCTL_VOLUME_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or (0 shl 2) or METHOD_BUFFERED); implementation {$R *.dfm} function GetLD(Drive: Char): Cardinal; var Buffer : String; begin Buffer := Format('\\.\%s:',[Drive]); Result := CreateFile(PChar(Buffer),GENERIC_READ Or GENERIC_WRITE,FILE_SHARE_READ,nil,OPEN_EXISTING,0,0); If Result = INVALID_HANDLE_VALUE Then begin Result := CreateFile(PChar(Buffer),GENERIC_READ,FILE_SHARE_READ,nil,OPEN_EXISTING,0,0); end; end; function GetPD(Drive: Byte): Cardinal; var Buffer : String; begin If Drive = 0 Then begin Result := INVALID_HANDLE_VALUE; Exit; end; Buffer := Format('\\.\PHYSICALDRIVE%d',[Drive]); Result := CreateFile(PChar(Buffer),GENERIC_READ Or GENERIC_WRITE,FILE_SHARE_READ,nil,OPEN_EXISTING,0,0); If Result = INVALID_HANDLE_VALUE Then begin Result := CreateFile(PChar(Buffer),GENERIC_READ,FILE_SHARE_READ,nil,OPEN_EXISTING,0,0); end; end; function GetPhysicalDiskNumber(Drive: Char): Byte; var LD : DWORD; DiskExtents : PVolumeDiskExtents; DiskExtent : TDiskExtent; BytesReturned : Cardinal; begin Result := 0; LD := GetLD(Drive); If LD = INVALID_HANDLE_VALUE Then Exit; Try DiskExtents := AllocMem(Max_Path); DeviceIOControl(LD,IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,nil,0,DiskExtents,Max_Path,BytesReturned,nil); If DiskExtents^.NumberOfDiskExtents > 0 Then begin DiskExtent := DiskExtents^.Extents[0]; Result := DiskExtent.DiskNumber; end; Finally CloseHandle(LD); end; end; procedure TfrmMain.btnMethod1Click(Sender: TObject); var PD : DWORD; CardSize: Int64; BytesReturned: DWORD; CallSuccess: Boolean; begin PD := GetPD(GetPhysicalDiskNumber(edtDrive.Text[1])); If PD = INVALID_HANDLE_VALUE Then Begin ShowMessage('Invalid Physical Disk Handle'); Exit; End; CallSuccess := DeviceIoControl(PD, IOCTL_DISK_GET_LENGTH_INFO, nil, 0, @CardSize, SizeOf(CardSize), BytesReturned, nil); if not CallSuccess then begin edtError.Text := IntToStr(GetLastError()); edtFail.Text := 'True'; end else edtFail.Text := 'False'; CloseHandle(PD); end; end. I placed a second method button on the form so I can write a different set of code into the app if I feel like it. Only minimal error handling and safeguards are there is nothing that wasn't necessary for debugging this via source. I tried this on a Sony Memory Stick using a PSP as the reader because I cant find the adapter for using a duo in my machine. The target is an MS and half of my users use a PSP for a reader half dont. However this should work fine on SD cards and that is a secondary target for my work as well. I tried this on a usb memory card reader and several SD cards. Now that I have fixed my attempt I get an error returned. 50 ERROR_NOT_SUPPORTED The request is not supported. I have found an application that uses this API as well as alot of related functions for what I am trying todo. I am getting ready to look into it the application is called DriveImage and its source is here - http://sourceforge.net/projects/diskimage/ The only thing I have really noticed from that application is there use of TFileStream and using that to get a handle on the physical disk.

    Read the article

  • Wiring up JavaScript handlers after a Partial Postback in ASP.NET

    - by Richard
    I am trying to use LinkButtons with the DefaultButton property of the ASP.NET Panel in an UpdatePanel. I have read and used the various other answers that are around describing the wiring up of the click event so that a full postback is not done instead of a partial postback. When the page loads, I wire up the .click function of the LinkButton so that the DefaultButton property of the ASP.NET panel will work. This all works fine, until you bring an UpdatePanel into the mix. With an UpdatePanel, if there is a partial postback, the script to wire up the .click function is not called in the partial postback, and hitting enter reverts to causing a full submit of the form rather than triggering the LinkButton. How can I cause javascript to be executed after a partial postback to re-wire up the .click function of the LinkButton? I have produced a sample page which shows the problem. There are two alerts showing 1) When the code to hook up the .click function is being called, and 2) When the .click function has been called (this only happens when you hit enter in the textbox after the event has been wired up). To test this code, type something in the textbox and hit Enter. The text will be copied to the label control, but "Wiring up Event Click" alert will not be shown. Add another letter, hit enter again, and you'll get a full postback without the text being copied to the label control (as the LinkButton wasn't called). Because that was a full postback, the Wiring Up Event Click event will be called again, and the form will work properly the next time again. This is being done with ASP.NET 3.5. Test Case Code: <%@ Page Language="C#" Inherits="System.Web.UI.Page" Theme="" EnableTheming="false" AutoEventWireup="true" %> <script runat="server"> void cmdComplete_Click(object sender, EventArgs e) { lblOutput.Text = "Complete Pressed: " + txtInput.Text; } void cmdFirstButton_Click(object sender, EventArgs e) { lblOutput.Text = "First Button Pressed"; } protected override void OnLoad(EventArgs e) { HookupButton(cmdComplete); } void HookupButton(LinkButton button) { // Use the click event of the LinkButton to trigger the postback (this is used by the .click code below) button.OnClientClick = Page.ClientScript.GetPostBackEventReference(button, String.Empty); // Wire up the .click event of the button to call the onclick function, and prevent a form submit string clickString = string.Format(@" alert('Wiring up click event'); document.getElementById('{0}').click = function() {{ alert('Default button pressed'); document.getElementById('{0}').onclick(); }};", button.ClientID, Page.ClientScript.GetPostBackEventReference(button, "")); Page.ClientScript.RegisterStartupScript(button.GetType(), "click_hookup_" + button.ClientID, clickString, true); } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>DefaultButton/LinkButton Testing</title> <style type="text/css"> a.Button { line-height: 2em; padding: 5px; border: solid 1px #CCC; background-color: #EEE; } </style> </head> <body> <h1> DefaultButton/LinkButton Testing</h1> <form runat="server"> <asp:ScriptManager runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div style="position: relative"> <fieldset> <legend>Output</legend> <asp:Label runat="server" ID="lblOutput" /> </fieldset> <asp:Button runat="server" Text="First Button" ID="cmdFirstButton" OnClick="cmdFirstButton_Click" UseSubmitBehavior="false" /> <asp:Panel ID="Panel1" runat="server" DefaultButton="cmdComplete"> <label> Enter Text:</label> <asp:TextBox runat="server" ID="txtInput" /> <asp:LinkButton runat="server" CssClass="Button" ID="cmdComplete" OnClick="cmdComplete_Click" Text="Complete" /> </asp:Panel> </div> </ContentTemplate> </asp:UpdatePanel> <asp:Button runat="server" ID="cmdFullPostback" Text="Full Postback" /> </form> </body> </html>

    Read the article

  • How to sort a gridview once a radio button is selected

    - by metashockwave
    I'm trying to sort records in the gridview right after a radio button is selected. My approach is with the dataview, but because the dataset variable doesn't survive a round trip to the server, I don't know how to make this happen. please help! Public Sub GetCustomers() db.RunProcedure("usp_customers_get_all") db.doSort(radList.SelectedValue) gvCustomers.DataSource = db.MyView End Sub Protected Sub radList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radList.SelectedIndexChanged If radList.SelectedValue = 0 Then db.doSort(0) gvCustomers.DataSource = db.MyView End If If radList.SelectedValue = 1 Then db.doSort(1) gvCustomers.DataSource = db.MyView End If End Sub Public Sub doSort(ByVal strIn As Integer) If strIn = 0 Then MyView.Sort = "lastname, firstname" Else MyView.Sort = "username" End If End Sub Public Sub RunProcedure(ByVal strName As String) Dim objConnection As New SqlConnection(mstrConnection) Dim mdbDataAdapter As New SqlDataAdapter(strName, objConnection) Try mdbDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure Me.mDataset.Clear() mdbDataAdapter.Fill(mDataset, "tblCustomers") MyView.Table = mDataset.Tables("tblCustomers") Catch ex As Exception Throw New Exception("stored procedure is " & strName.ToString & " error is " & ex.Message) End Try End Sub

    Read the article

  • NAudio: How can I get an event that tells me that the MP3 file reached the end?

    - by Rookian
    I tried to use this: private void CreateDevice() { _playbackDevice = new WaveOut(); _playbackDevice.PlaybackStopped += PlaybackDevicePlaybackStopped; } void PlaybackDevicePlaybackStopped(object sender, EventArgs e) { if (OnPlaybackStopped != null) { OnPlaybackStopped(this, e); } } But it never invoked. Then I tried to use the PlaybackState by polling the property with a timer: public PlaybackState PlaybackState { get { if (_playbackDevice == null) return default(PlaybackState); return _playbackDevice.PlaybackState; } } But when the song ends it does not change to "stopped". But when I call Stopped it changes correctly. Can someone help me?

    Read the article

  • SQL ConnectionString in global.asax overridden by web.config

    - by rlb.usa
    This is going to sound very odd, but I have a web.config like this: <connectionStrings> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Data Source=BACKUPDB;..." providerName="System.Data.SqlClient"/> </connectionStrings> And a global.asax like this: void Session_Start(object sender, EventArgs e) { // Code that runs when a new session is started if (Application["con"] == null || Application["con"] == "") { Application["con"] = "Data Source=PRODUCTIONDB;..."; } } And EVERYWHERE in my code, I reference my ConnectionStrings like this: SqlConnection con = new SqlConnection(Convert.ToString(HttpContext.Current.Application["con"])); However, I see that everything I do inside this application goes to BACKUP db instead of PRODUCTIONDB. What is going on, how could this happen, and why? It doesn't make any sense to me, and it got me into a lot of trouble. We use LocalSqlServer string for FormsAuthentication.

    Read the article

  • Problem in SQL Server 2005 using ASP.Net

    - by megala
    I created one ASP.Net project using SQLServer database as back end.I shows the foollwing error .How to solve this? ===============Coding Imports System.Data.SqlClient Partial Class Default2 Inherits System.Web.UI.Page Dim myConnection As SqlConnection Dim myCommand As SqlCommand Dim ra As Integer Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click myConnection = New SqlConnection("Data Source=JANANI-FF079747\SQLEXPRESS;Initial Catalog=new;Persist Security Info=True;User ID=sa;Password=janani") 'server=localhost;uid=sa;pwd=;database=pubs") myConnection.Open() myCommand = New SqlCommand("Insert into table3 values 'janani','jan'") ra = myCommand.ExecuteNonQuery() ========---> error is showing here MsgBox("New Row Inserted" & ra) myConnection.Close() End Sub End Class =========Error Message============ ExecuteNonQuery: Connection property has not been initialized.

    Read the article

  • set Image to Button

    - by Ivan
    Hello all, Could somebody help me a little bit with my issue below? When I call the myFunction, images which I want to set to buttons appear after 2 sec simultaneously, not one by one with delay of 0.5 sec. More info: generatedNumbers is array with four elements of NSNumber (4,1,3,2) buttons are set in UIView via IB and are tagged (1,2,3,4) -(IBAction) myFunction:(id) sender { int i, value; for (i = 0; i<[generatedNumbers count]; i++) { value = [[generatedNumbers objectAtIndex:i] intValue]; UIButton *button = (UIButton *)[self.view viewWithTag:i+1]; UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"%d.png",value]]; [button setImage:img forState:UIControlStateNormal]; [img release]; usleep(500000); } }

    Read the article

  • How to Access a Control present inside a DataTemplate

    - by Subhen
    Hi, I have Few TextBlock inside the Data template as follow: <DataTemplate> <StackPanel x:Name="stackPanelItems" Orientation="Horizontal"> <TextBlock x:Name="myTextBox" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="14" /> </StackPanel> </DataTemplate> Now we need to Make the myTextBox Collsapsed in some scenarios but dont want to use the loaded or click event and then access the control via sender. Can I used any other method or way? Thanks, Subhen

    Read the article

  • asp:menu in safari and chrome

    - by Patto
    I have seen some posts of the asp:menu and the browsers Chrome and Safari here, but nevertheless, I think the problem that I have is different than other problems. I am using the following code in order to display the menu: protected void Page_Load(object sender, EventArgs e) { if (Request.UserAgent.IndexOf("AppleWebKit") > 0) { Request.Browser.Adapters.Clear(); } ... } However, the problem is still there if I start the browsers for the very first time, the menu is displayed vertically instead of horizontally. After a page refresh, the menu works fine... How is that possible? Or is the problem that simple,and I need to place the code in somewhere earlier (eg Page_PreInt). Thanks in advance, Patto

    Read the article

  • HOw to use UIIMagePickerController?

    - by aman-gupta
    Hey, IN my application I m using this code on button click for getting image from PhotoLibrary:- -(IBAction) getPhoto:(id) sender { UIImagePickerController *picker = [[UIImagePickerController alloc]init]; picker.delegate = self; picker.sourceType =UIImagePickerControllerSourceTypePhotoLibrary; [self presentModalViewController:picker animated:YES]; [picker release]; //picker = nil; } -(void)imagePickerController:(UIImagePickerController *) picker didFinishPickingMediaWithInfo:(NSDictionary *)info { imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; [picker dismissModalViewControllerAnimated:YES]; } But problem is that when i run my application in mobile it will get terminated on button click.Where I m wrong it works properly on iphone simulator but termninating on iphone Device Please reply me its urgent Thanks in Advance

    Read the article

  • What is the best way to transmit Java objects over a network

    - by tomdee
    I am trying to transmit objects of a particular class from one server to another. The options I'm looking at are: Serialize the data as JSON and send it over the wire using HTTP, and de-serialize at the other end. Serialize the data into some binary form and transmit using TCP sockets. What are the best practices in this area? What are the gotchas? Ideally I would like the interface to be versioned, so the sender and receiver can be upgraded independently. I'm considering the JSON approach as I already have code that will serialize/deserialize the objects into JSON.

    Read the article

  • Adding Item to DataBound Drop Down List

    - by Stephen
    Yes, I have read most of the topics here, but I can't find an answer that works. I have Three drop-down lists. The first is databound to grab distinct experiment names. The user selects, page posts back, and the second drop-down menu displays distinct time points. This is where I need help. I need to add an item to THAT drop-down list whose ID, DataTextField, DataValueField are all TimePt. Seems simple, but I can't get it to work. protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { TimePt.DataSource = TimePTDD; TimePt.DataValueField = "TimePt"; TimePt.DataTextField = "TimePt"; TimePt.DataBind(); TimePt.Items.Insert(0, new ListItem("--Select---", "0")); TimePt.SelectedIndex = 0; } } I'm missing sometthing.

    Read the article

  • SelectedValue of DropDownList is not the one I selected when Enabled=false

    - by anD666
    Hiya, I have a few DropDownLists on a webform each pointing to a SqlDataSource. Some of these datasources use one of these DropDownLists for a select parameter, filtering the list to specific categories. For certain users two of these DropDownLists are to be automatically set and disabled. When I submit the form with the drop downs enabled it works fine but when they are disabled the SelectedValue of the DropDownList is being reset to the first one in the list. My DropDownLists are constructed as follows: <asp:DropDownList ID="ddlManager" runat="server" DataSourceID="dsManagers" EnableViewState="false" DataValueField="ManagerID" DataTextField="MgrName" AppendDataBoundItems="false" ondatabound="ddlManager_DataBound" > The drop down lists add an extra item on the data bound event as follows: protected void ddlManager_DataBound(object sender, EventArgs e) { this.ddlManager.Items.Insert(0, new ListItem("--Manager--", "--Manager--")); } Can anyone shed any light as to why this is happening? Thanks Andy

    Read the article

  • VB.net Cross-Thread

    - by PandaNL
    Hello, I have a cmd command that needs to be executed, when the command starts it starts to fill a progressbar. When the cmd command is done the progressbar needs to fill up to 100. This is the code i use, but it gives me an error when the progressbar.Value = 100 comes up. Public Class Form1 Dim teller As Integer Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerProgressbar.Tick teller += 1 ProgressBar1.Value = teller If ProgressBar1.Value = ProgressBar1.Maximum Then TimerProgressbar.Stop() End If End Sub This are the tow commands in another private sub where the app is crashing on ProgressBar1.Value = 100 TimerProgressbar.Stop() When i debug it and i try it out it crashes on ProgressBar1.Value = 100 But when i build it under Windows 7 it runs fine without crashing, however a few people reported me it crashes on there Windows xp system. VB gives me a suggestions about Cross Thread, but i don't know how i could make it work with this.

    Read the article

  • iPhone modal View with parent view semi-visible?

    - by Moshe
    I am adding a modal view using the following code: [self presentModalViewController:phrasesEditor animated:YES]; How can I make the modal view semi-transparent so that the superview "shines" through? My complete method/function looks like this: -(IBAction)showEditPhrases:(id)sender{ PhrasesViewController *phrasesEditor = [[PhrasesViewController alloc] initWithNibName:@"PhrasesViewController" bundle:nil]; phrasesEditor.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [phrasesEditor.view setAlpha: 0.5]; [phrasesEditor.view setBackgroundColor: [UIColor clearColor]]; [self presentModalViewController:phrasesEditor animated:YES]; [phrasesEditor release]; }

    Read the article

  • UIView animation doesn't work first time

    - by BobC
    Hello everybody, I have a seachButton in the navigation bar which upon hitting calls following method: - (IBAction)search:(id)sender { if (nil == searchViewController) searchViewController = [[SearchViewController alloc] initWithNibName:@"SearchViewController" bundle:nil]; searchViewController.view.backgroundColor = [UIColor clearColor]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.0]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:searchViewController.view cache:NO]; [self.view addSubview:searchViewController.view]; [UIView commitAnimations]; } It should load SearchViewController.xib which contains a view with UISearchBar and two buttons. When I call the search method for the first time, the view appears very quickly with some weird animation, when I call it again, the animation is alright. Does anyone have a clue what could be wrong?

    Read the article

  • How to properly use Gearman with my PHP application?

    - by luckytaxi
    For now I just want to use Gearman for background processing. For example, I need to email a recipient that they have a private message waiting for them once the sender submits their message into the DB. I assume I can run the worker/client and server on my primary server but I have no problems offloading some of the tasks to a different web server. Anyways, my question is how do I handle multiple "functions?" Let's say I need a job that handles the email portion and a job to handle image manipulation. Can I have multiple functions in the worker? I've followed a couple of examples I found online but each example only shows one function being initialized. Do I have to start up multiple "workers" to handle multiple functions?

    Read the article

  • Calling Sub from EventHandler

    - by madlan
    I'm using the below to update controls from another thread (works great) How would I call a Sub (Named UpdateList)? The UpdateList updates a listview with a list of databases on a selected SQL instance, requires no arguments. Private Sub CompleteEventHandler(ByVal sender As Object, ByVal e As Microsoft.SqlServer.Management.Common.ServerMessageEventArgs) SetControlPropertyValue(Label8, "text", e.ToString) UpdateList() MessageBox.Show("Restore Complete") End Sub Delegate Sub SetControlValueCallback(ByVal oControl As Control, ByVal propName As String, ByVal propValue As Object) Private Sub SetControlPropertyValue(ByVal oControl As Control, ByVal propName As String, ByVal propValue As Object) If (oControl.InvokeRequired) Then Dim d As New SetControlValueCallback(AddressOf SetControlPropertyValue) oControl.Invoke(d, New Object() {oControl, propName, propValue}) Else Dim t As Type = oControl.[GetType]() Dim props As PropertyInfo() = t.GetProperties() For Each p As PropertyInfo In props If p.Name.ToUpper() = propName.ToUpper() Then p.SetValue(oControl, propValue, Nothing) End If Next End If End Sub Based On: http://www.shabdar.org/cross-thread-operation-not-valid.html

    Read the article

  • ApplicationCommand.Paste happens twice

    - by Carlo
    Hi, well this is driving me crazy. We have a command like so: <CommandBinding Command="ApplicationCommands.Paste" CanExecute="HasClipboardData" Executed="OnPasteExecuted"/> And the code for OnPasteExecuted is this: private void OnPasteExecuted(object sender, ExecutedRoutedEventArgs e) { CurrentView.Paste(); e.Handled = true; } That code gets executed twice, and I have no idea why, we also have the other commands: Cut, Copy, Undo, Redo, those work just fine, the problem is only with Paste. Let me know if you have any idea of what could be going on. Thanks!

    Read the article

  • VB.NET WebBrowser control not navigating to a local document

    - by blerh
    I have this code set up to navigate to a certain .html document depending on what's selected from a ListBox: Private Sub FileList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileList.SelectedIndexChanged HelpWindow.Navigate(System.AppDomain.CurrentDomain.BaseDirectory & "help\" & fileArray(FileList.SelectedIndex, 1)) End Sub The problem is, when I first select something in the ListBox, it successfully navigates to that file and displays it. But when I select something a second time it doesn't change. All of the paths it's trying to navigate to are correct. I've checked this 1000 times. Anyone have any clues why this isn't working? Thank you.

    Read the article

  • [Unsolved] RowsDeleting event doesn't fire

    - by iTayb
    I have a gridview with a onrowdeleting="SellersGridView_RowsDeleting" switch. My method is: protected void SellersGridView_RowsDeleting(object sender, GridViewDeleteEventArgs e) { string seller = ((Label)SellersGridView.Rows[e.RowIndex].Cells[0].FindControl("TextBoxSeller")).Text; BookStore b = new BookStore(); b.LoadFromXML(Server.MapPath("list.xml")); string ISBN = Request.QueryString["ISBN"].ToString(); int ID = b.BooksList.FindIndex(x => x.ISBN == ISBN); Book myBook = b.BooksList[ID]; myBook.RemoveSeller(seller); Response.Redirect("editbook.aspx?ISBN=" + ISBN); } Well, it seems that when I try to delete anything - nothing happens. I tried to change the first line to Response.Redirect("foo") just to check if the event itself is fired, and it turns out that it doesn't. I can't get The reason. Here is my gridview control: http://pastebin.com/CKDAMECT Here is my codebehind code: http://pastebin.com/ShBtwGEu Thank you very much!

    Read the article

< Previous Page | 87 88 89 90 91 92 93 94 95 96 97 98  | Next Page >