Search Results

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

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

  • How to pass an event to a method and then subscribe to it?

    - by Ryan Peschel
    Event Handler public void DeliverEvent(object sender, EventArgs e) { } #1: This Works public void StartListening(Button source) { source.Click += DeliverEvent; } #2: And so does this.. public void StartListening(EventHandler eventHandler) { eventHandler += DeliverEvent; } But in #2, you cannot call the method because if you try something like this: StartListening(button.Click); You get this error: The event 'System.Windows.Forms.Control.Click' can only appear on the left hand side of += or -= Is there any way around that error? I want to be able to pass the event and not the object housing the event to the StartListening method.

    Read the article

  • How to get characters read from the keyboard?

    - by Sandy
    Hi, I am trying to get the characters read from the keyboard. I have the following list of that I wish to recognize if entered by a user. List of keyboard entries: letters [ ] ~ ^ numbers Part of the code: void HookManager_KeyUp(object sender, KeyEventArgs e) { string test = e.KeyCode.ToString(); Here numbers, letters and square brackets work correctly but the ~ and ^ which require shift key is read incorrectly. For eg. it reads ^ which is on key 6 as a value of 6 and not ^ as it should be. Any help would be appreciated. Thanks AA

    Read the article

  • Issue with focus of a Silverlight Listbox

    - by Malcolm
    I have a button and on click of that i show a popup which has a listbox. popup named - popComboList Listbox named - lstComboBoxResult I am giving a focus to a listbox but at initial on a click of a button the listbox doesn't get focus-(this happens only once at initial, when i first time click button) After the second click it works. private void bnOpen_Click(object sender, RoutedEventArgs e) { if (IsDesignTime) return; lstComboBoxResult.Width = tbComboValue.ActualWidth + bnOpen.ActualWidth; if (!popComboList.IsOpen) { SetPopupPosition(popComboList); popComboList.IsOpen = true; lstComboBoxResult.Focus(); } else { popComboList.IsOpen = false; } }

    Read the article

  • http_post() variables to php script from SMS message but only append data to text file if certain variable (telephone number) equals a known

    - by user1592162
    All, I have an SMS gateway application running on my server that passes incoming SMS messages to a php script. That script writes the data to a text file. Certain aspects of the message can be extracted as variables - for example: Message content: $msgdata Sender: $originator Time: $receivedtime etc... Using the script below I can easily write the message to a text file but it will write the data of every SMS that comes in. I only want to write to a text file if the $originator variable is a certain telephone number (e.g 07123456321) $date = date("d.m.Y H:i:s"); $msgdata = $_REQUEST["msgdata"]; $myFile3 = "test.txt"; $fh = fopen($myFile3, 'a') or die("can't open file"); $stringData3 = "$date - $msgdata\n"; fwrite($fh, $stringData3); fclose($fh); Your assistance is bery much appreciated. Many thanks in advance.

    Read the article

  • Modify Hyperlinkfield text in Gridview

    - by JohnG
    I am stumped on this one. I want to modify the text in a Hyperlinkfield of Gridview after the data is bound to it. I found similar code to this on msdn and I can't get it to work. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Cells[2].Text = e.Row.Cells[2].Text + "random text"; } I also tried similar code in the Page_PreRender event with no luck. I have also tried calling DataBind() before this one line of code with no help. I always just get "random text" in the cell without the data from the DB. Thanks

    Read the article

  • ASP.NET Ajax partial postback and jQuery problem

    - by chromaloop
    A control contains some HTML and some jQuery to handle a fancy tooltip to display when you click an image within a div. The control is then used on several different pages, sometimes within an updatePanel, sometimes not. I have the following code to handle loading the jQuery after a partial postback when the control is displayed within an update panel. Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler(sender, args) { $('img.ormdShipping').each(function(){ $(this).qtip({ // some qtip options go here }) }); } Problem is, the jQuery doesn't load when the control is used anywhere other than an updatePanel. Do I need a second function that's triggered outside of the EndRequestHandler?

    Read the article

  • How to update a control outside of an updatepanel?

    - by Matin Habibi
    Dear all, I am going to show some text in a TextBox, which is located outside of an updatepanel, after checking a CheckBox but I cannot make it work. please help me out ? Here is my code: <asp:UpdatePanel runat="server" ID="uplMaster"> <ContentTemplate> <asp:CheckBox ID="cbShowText" runat="server" Text="Show Some Text" AutoPostBack="true" OnCheckedChanged="cbShowText_CheckedChanged" /> </ContentTemplate> </asp:UpdatePanel> <asp:TextBox ID="txtBox" Text="Empty" runat="server" /> Code Behind: protected void cbShowText_CheckedChanged(object sender, EventArgs e) { txtBox.Text = "Some Text"; } Thanks in advance :D P.S. As you might have guessed, I have resembled my problem and that is why I don't want to put the TextBox in the UpdatePanel

    Read the article

  • problem in adding image to the UIButton.

    - by monish
    Hi friends, I got an another problem in my application and I am wasting so much of time on that. Does pls anyone can help with this problem. Actually I had an Event and I should give rating for that event for that I wrote the code as: In CellForRowAtIndexPath......I had the code as: - (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MasterViewIdentifier"]; //UITableViewCell *cell = nil; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"MasterViewIdentifier"] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleNone; UIView* elementView = [[UIView alloc] initWithFrame:CGRectMake(20,170,320,280)]; elementView.tag = 0; elementView.backgroundColor=[UIColor clearColor]; [cell.contentView addSubview:elementView]; [elementView release]; } UIView* elementView = [cell.contentView viewWithTag:0]; elementView.backgroundColor=[UIColor clearColor]; for(UIView* subView in elementView.subviews) { [subView removeFromSuperview]; } if(indexPath.section == 8) { UIImage *whiteImg = [UIImage imageNamed:@"white_star.png"] ; UIImage *yellowImg = [UIImage imageNamed:@"yellow_Star.png"] ; UIButton *button1 = [[UIButton alloc]initWithFrame:CGRectMake(159, 15, 25, 20)]; [button1 addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; button1.tag = 1; UIButton *button2 = [[UIButton alloc]initWithFrame:CGRectMake(185, 15, 25, 20)]; [button2 addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; button2.tag = 2; UIButton *button3 = [[UIButton alloc]initWithFrame:CGRectMake(211, 15, 25, 20)]; [button3 addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; button3.tag = 3; UIButton *button4 = [[UIButton alloc]initWithFrame:CGRectMake(237, 15, 25, 20)]; [button4 addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; button4.tag = 4; UIButton *button5 = [[UIButton alloc]initWithFrame:CGRectMake(263, 15, 25, 20)]; [button5 addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; button5.tag = 5; if(event.eventRatings == 1) { [button1 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button2 setBackgroundImage:whiteImg forState:UIControlStateNormal]; [button3 setBackgroundImage:whiteImg forState:UIControlStateNormal]; [button4 setBackgroundImage:whiteImg forState:UIControlStateNormal]; [button5 setBackgroundImage:whiteImg forState:UIControlStateNormal]; } else if(event.eventRatings == 2) { [button1 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button2 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button3 setBackgroundImage:whiteImg forState:UIControlStateNormal]; [button4 setBackgroundImage:whiteImg forState:UIControlStateNormal]; [button5 setBackgroundImage:whiteImg forState:UIControlStateNormal]; } else if(event.eventRatings == 3) { [button1 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button2 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button3 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button4 setBackgroundImage:whiteImg forState:UIControlStateNormal]; [button5 setBackgroundImage:whiteImg forState:UIControlStateNormal]; } else if(event.eventRatings == 4) { [button1 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button2 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button3 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button4 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button5 setBackgroundImage:whiteImg forState:UIControlStateNormal]; } else if(event.eventRatings == 5) { [button1 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button2 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button3 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button4 setBackgroundImage:yellowImg forState:UIControlStateNormal]; [button5 setBackgroundImage:yellowImg forState:UIControlStateNormal]; } else { [button1 setBackgroundImage:whiteImg forState:UIControlStateNormal]; [button2 setBackgroundImage:whiteImg forState:UIControlStateNormal]; [button3 setBackgroundImage:whiteImg forState:UIControlStateNormal]; [button4 setBackgroundImage:whiteImg forState:UIControlStateNormal]; [button5 setBackgroundImage:whiteImg forState:UIControlStateNormal]; } [elementView addSubview:button1]; [button1 release]; [elementView addSubview:button2]; [button2 release]; [elementView addSubview:button3]; [button3 release]; [elementView addSubview:button4]; [button4 release]; [elementView addSubview:button5]; [button5 release]; if(isRightButton == YES) { button1.enabled = NO; button2.enabled = NO; button3.enabled = NO; button4.enabled = NO; button5.enabled = NO; } else if(isRightButton == NO) { button1.enabled = YES; button2.enabled = YES; button3.enabled = YES; button4.enabled = YES; button5.enabled = YES; } [elementView addSubview:ratingsTitleLabel]; cell.accessoryType = UITableViewCellAccessoryNone; } return cell; } And the action of the button is written as: -(void)buttonAction:(id)sender { rating = [sender tag]; printf("\n Ratig Value inside Button Action~~~~~~~~~~~~~~~~%d",rating); event.eventRatings = rating; [tableView reloadData]; } When I build the application in simlator of 3.1.2 O.S its working fine by displaying the star images. My porblem is when I build it in 3.1.2 O.S Device the images are not displaying.I checked the code for casesensitivity in file name and its gud but Im not gettig the images to display. Guys help me to solve this. Thank you, Monish Kumar.

    Read the article

  • Problems with list<T> in Asp.Net c#

    - by Johnathan Nardia
    I'm making a web app in Asp.Net using c# that lets you add items into the list. My problem is that each time that i click the button to add a new item into the list , its just shows me the last item and the list counter shows me only 1 . What am I doing wrong?? Here is the code : public partial class home : System.Web.UI.Page { List<string> messageboxs = new List<string>(); public string val = ""; public string data = ""; protected void Button1_Click(object sender, EventArgs e) { val = ""; messageboxs.Add(text1.Text); ListBox1.DataSource = messageboxs; ListBox1.DataBind(); val = messageboxs.Count.ToString(); } }

    Read the article

  • iphone instance / class method issue

    - by user290031
    Hey All, Okay, so I have a viewController method that has some elements created with interface builder and some I coded myself. I created a view in the IB...lets call it viewOne. I created a loop that creates buttons (through code) and places them on a separate view (viewTwo). This is done in a class method. However, I want the view I made to be opened everytime one of the buttons is clicked. So I did: [button addTarget:self action:@selector(woogoo:) forControlEvents:UIControlEventTouchUpInside]; The woogoo class does the following: +(void) woogoo:(id)sender { //back button [self.view addSubview:viewOne] } However, the program crashes when a button is clicked. I did try making woogoo an instance method but it also crashes in this case too. All I want to do is show viewOne when a button is clicked. Any ideas what I can do?

    Read the article

  • Need file read in from form load

    - by Luke
    I am using a listview, and trying to populate using a file. I need the file to be read in as soon as the form starts. private void mainForm_Load(object sender, EventArgs e) { //get file read in if (File.Exists("../../MealDeliveries.txt")) { StreamReader sr = new StreamReader("../../MealDeliveries.txt"); //first line is delivery name string strDeliveryName = sr.ReadLine(); do { //other lines Delivery d = new Delivery(strDeliveryName, sr.ReadLine(), sr.ReadLine(), sr.ReadLine(), sr.ReadLine(), sr.ReadLine(), sr.ReadLine()); mainForm.myDeliveries.Add(d); //check for further values strDeliveryName = sr.ReadLine(); //stop if no more values } while (strDeliveryName != null); displayDeliveries(); } } Should this work?

    Read the article

  • Web-Cam Video frames to System.Drawing.Bitmap

    - by Hooch
    Hello. I'm using AForge.NET framework to process some data from webcam. My Image processor is working. class WebProc { public void Process(System.Drawing.Bitmap image) { .... } } I know how to send image from HDD. I was thinking about something like that: private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { while(!backgroundWorker1.CancellationPending) { Bitmap Frame GetVidoFrameSomeWay(); WebProc.Process(Frame); } } Can you help me with those questions? How to get frame from webcam? How to list all available webcam for user to chose from? How to open Webcam setting window? Is there a way to set frame size to 640x480 o user size?

    Read the article

  • Creating/Handling events for controls when added during runtime.

    - by AllStar11
    I am using a Repeater which contains a placeholder. The placeholder is bound to my database and each ItemTemplate contains 1-6 radiobuttons depending on what the database returns. What I need to do is somehow keep track of which one of the radiobuttons is checked for each question so I can write the user's answers to the database when they complete the test, any ideas?? <asp:Repeater ID="Repeater1" OnItemDataBound="R1_ItemDataBound" runat="server"> <ItemTemplate> <asp:PlaceHolder ID="phAnswers" runat="server"> </asp:PlaceHolder> </ItemTemplate> </asp:Repeater> Sub R1_ItemDataBound(ByVal Sender As Object, ByVal e As RepeaterItemEventArgs) Dim tempPH As PlaceHolder tempPH = e.Item.FindControl("phAnswers") For x As Integer = 0 To (t_MC.Count - 1) newRadio = New RadioButton newRadio.ID = "Answer" + x.ToString newRadio.GroupName = "Answer" + tempQuestion.ID.ToString newRadio.Text = t_MC(x).Value newRadio.Width = 800 tempPH.Controls.Add(newRadio)

    Read the article

  • Handle leaks with .NET System.Threading.Thread class

    - by Mahno
    I've a problem that number of Handles in my app is continuously growing. I did the debugging and recognize that this is caused by System.Threading.Thread class which is used for some routine. To simplify the debugging I’ve created a sample .NET application: ... private void button1_Click(object sender, EventArgs e) { Thread t = new Thread(DoWork); t.Start(); } public void DoWork(object parameter) { // Do something... } ... Each time I’m clicking the button, a thread is created using System.Threading.Thread class. The problem is that looks like the thread do not frees Handles because each click cause number of Handles growing by ~5. The question is: how can I manually free all Handles created by System.Threading.Thread class? Thanks in advance.

    Read the article

  • NSImage different size in code different shown by Finder/Preview

    - by krasnyk
    I have a couple of images that i use in my application(one of them is attached). The strange thing is that the real image size(shown by finder and preview) is 1200x701 px. When I access image from the code and as for its size, I get 360x210px. What is going on? Code I'm using to get the size of the image: NSImage *newImg = [[NSImage alloc] initWithContentsOfURL: [NSURL URLFromPasteboard:[sender draggingPasteboard]]]; float h = [newImg size].height; //height is 210px - should be 701px float w = [newImg size].width; //width is 320px - should be 1200px The content of the newImg is the same image that has been pointed and loaded - I display it in the NSImageView anyway so I see. Just the size taken with -size is wrong. This is the image:

    Read the article

  • collapsible grid in Silverlight 4

    - by prince23
    hi, I want to create a collapsible grid in Silverlight 4. once user clicks on row of the datagrid if that row has any child row it should be shown. if again user clicks the same row should hide the child row what was shown eariler. right now i am able to show data in datagrid once the user clicks any row i am able get the id of the row what i have clicked and go to DB and get the result. but how will i again bind the new datatable to datagrid agin. below the row what i have clciked private void dgData2_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (dgData2.SelectedIndex >= 0) { //Get Selected Row var element = (TextBlock)dgData2.Columns[0].GetCellContent(dgData2.SelectedItem); } } i am new to silverlight please let me know any code that can help e out Thanks in advance for any help prince

    Read the article

  • Why doesnt doesnt HTML input of type file not work with Ajax update panel

    - by Sean P
    I have a input of type file and when i try to do a Request.files when the input is wrapped in an update panel...it always returns an empty httpfilecollection. Why??? This is the codebehind: (At HttpContext.Current.Request.Files...its always 0 for the count.) Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click Dim uploads As HttpFileCollection uploads = HttpContext.Current.Request.Files For i As Integer = 0 To (uploads.Count - 1) If (uploads(i).ContentLength > 0) Then Dim c As String = System.IO.Path.GetFileName(uploads(i).FileName) Try uploads(i).SaveAs("C:\UploadedUserFiles\" + c) Span1.InnerHtml = "File Uploaded Sucessfully." Catch Exp As Exception Span1.InnerHtml = "Some Error occured." End Try End If Next i End Sub This example comes from the ASP.Net website...but my application is very similar.

    Read the article

  • how i insert values from list of Data Grid View?

    - by Six fourty
    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

  • Receving multiple multicast feeds on the same port - C, Linux

    - by Gigi
    I have an application that is receiving data from multiple multicast sources on the same port. I am able to receive the data. However, I am trying to account for statistics of each group (i.e. msgs received, bytes received) and all the data is getting mixed up. Does anyone know how to solved this problem? If I try to look at the sender's address, it is not the multicast address, but rather the IP of the sending machine. I am using the following socket options: struct ip_mreq mreq; mreq.imr_multiaddr.s_addr = inet_addr("224.1.2.3"); mreq.imr_interface.s_addr = INADDR_ANY; setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)); and also: setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &reuse, sizeof(reuse)); I appreciate any help!!!

    Read the article

  • drop down list had zero value

    - by KareemSaad
    I had ddl which in selected changed it execute some code but when i tried to do that it wasn't worked well WHEN i checked the reason i found that ddl in selected value =0 also i made all well and this is my code protected void DDlProductFamily_SelectedIndexChanged(object sender, EventArgs e) { if (DDlProductFamily.DataValueField.Contains("ProductCategory_Id")) using (SqlConnection Con = Connection.GetConnection()) { SqlCommand Com = new SqlCommand("GetListViewByProductCategory", Con); Com.CommandType = CommandType.StoredProcedure; Com.Parameters.Add(Parameter.NewInt("@ProductCategory_Id", DDlProductFamily.SelectedValue.ToString())); SqlDataAdapter DA = new SqlDataAdapter(Com); DA.Fill(dt); DataList1.DataSource = dt; DataList1.DataBind(); } }

    Read the article

  • Overriding Page class constructor in ASP.NET code-behind file -- when is it called?

    - by CSharp Noob
    If I override the System.Web.UI.Page constructor, as shown, when does DoSomething() get called in terms of the page lifecycle? I can't seem to find this documented anywhere. namespace NameSpace1 { public partial class MyClass : System.Web.UI.Page { public MyClass() { DoSomething(); } protected void Page_Load(object sender, EventArgs e) { } } } For reference, here is the ASP.NET Page Lifecycle Overview: http://msdn.microsoft.com/en-us/library/ms178472.aspx Turns out the best answer was right in the MSDN article. I just had to look carefully at the diagram.

    Read the article

  • Add directories to root of Zip folder Ionic Zip c#

    - by Movieboy
    I asked this a few months ago, and only received one response which didn't work. I've been tinkering with it for the past few weeks, and I'm still completely lost, so I would appreciate anyone else's input as I'm all out of ideas. what I'm trying to do is add a list of folders and files all to the root of my Zip file, using the Ionic Zip library (c#). Here's what I have so far string k = "B:/My Documents/Workspace"; private void button1_Click(object sender, EventArgs e) { using (ZipFile zip = new ZipFile()) { //add directory, give it a name zip.AddDirectory(k); zip.Save("t.zip"); } } Now, I want my zip to be looking like this. t.zip -Random Files and Folder But it's looking like this. t.zip -t (folder) -Random files and folders Any help would be appreciated, Thank you.

    Read the article

  • Fire just once a Thread in Asp.net WebSite Global.asax

    - by Luís Custódio
    I've a legacy application using Asp.Net WebSite (winforms...) and I need run a background thread that collect periodically some files. But this thread must run just one time! My problem start when I put a method in Application_Start: void Application_Start(object sender, EventArgs e) { SetConnection(); SetNHibernate(); SetNinject(); SetExportThread(); } So I start my application on Visual Studio and three threads start to run. I need some singleton? or something?

    Read the article

  • facebook messages result set like part 2

    - by David
    Hey guys, I don't think I'm getting it right. Here is my most recent query that I believe is almost working. SELECT max(sender_id) as sender_id, subject, MAX(id) as message_id, MAX(created_at) as updated_at FROM messages where (recipient_id = #{current_user} and recipient_deleted = 'f') or sender_id = #{current_user} GROUP BY subject ORDER BY max(created_at) DESC ; Basically the goal is to fetch all recent messages of a user, group them by subject, and make sure that the photo that is showing up is the other party's photo, never the current user. (also need the most recent message body and message count but that is for another time) Here is what I think is wrong. doing max(sender_id) is wrong, since the current_user id could be higher than the sender's id. I am using the sender_id in the html page to fetch the user's photo.

    Read the article

  • How to implement RFC 3393 (Ipdv packet delay varation) in C?

    - by sagar
    Hello , I am building an Ethernet Application in which i will be sending packets from one side and receiving it on the other side. I want to calculate delay in packets at the receiver side as in RFC 3393. So I have to put a timestamps in the packet at the sender side and then take the timestamps at the receiver side as soon as i receive the packet . Subtracting the values i will get the difference in timestamps and then subtracting this value with subsequent difference i will get One way ipdv delay . Both the clocks are not synchronized . So any help is greatly appreciated. Thank you.

    Read the article

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