Search Results

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

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

  • C# compile error for simple Annual Salary Calculator

    - by Mike Vignapiano
    I am new to C# and trying to create my 1st app. I have 3 errors. The first two say that txtSalary and Salary do not exist. The 3rd says that it cannot convert method group 'ToString' to non-delegate type 'string'. and asks if I intend to invoke the method. Here is what I have: protected void Button1_Click(object sender, EventArgs e) { int salary, AnnualHours, Rate; string txtAnnualHours, txtSalary, txtRate; salary = AnnualHours * Rate; txtsalary = int.Parse(Salary); txtAnnualHours = salary.ToString; MessageBox.Show(salary); } According to my book, when you enter numerics in AnnualHours and Rate textbox, when click Button1, these values are converted from string to integers, then multiplied for salary. Then numeric answer converted to string and displayed in messagebox named txtSalary. Please show me what I got wrong because according to the book, I am not missing anything.

    Read the article

  • Event handling C# / Registering a callback

    - by Jeff Dahmer
    Events can only return void and recieve object sender/eventargs right? If so then craptastic.... how can I pass a function pointer to another obj, like: public bool ACallBackFunc(int n) { return n > 0; } public void RegisterCallback(Something s) { s.GiveCallBack(this.ACallBackFunc); } Something::GiveCallBack(Action? funcPtr) I tried using Action, but I need it to return some value and Actions can only return void. Also, we do not know what kind of a callback we will be recieving; it could return anything and have any params! Reflection will have to be used somehow I reckon.

    Read the article

  • Problem TreeView OnTreeNodePopulate event

    - by purnang.advant
    Hi. I am using a treeview in asp.net 3.5(using c#.net),which is populated from sqldatabase. OnTreeNodePopulate event fires this event, protected void tvLabs_TreeNodePopulate(object sender, System.Web.UI.WebControls.TreeNodeEventArgs e) { PopulateSubLevelLab(e.Node.Value, e.Node); //This function is used for populating the child node. FillLabGrid(e.Node.Value);---My Question? } ---My Question? The FillLabGrid method used for fill a grid view on the basis of selecting the treeview parent node. But this function filled the grid only once when i click the parent node for the first time. Secondly when i collapse the treeview and again click on the parent node function (tvLabs_TreeNodePopulate)is not called? Hope you are getting my point. Please advice me. Thanks in advance.

    Read the article

  • Imposing email limits on web page

    - by Martin
    To avoid spammers, what's a good strategy for imposing limits on users when sending email from our site? A count limit per day on individual IPs? Sender emails? Domains? In general terms, but recommended figures will also be helpful. Our users can send emails through our web page. They can register and log in but are also allowed to do this without logging in, but with a captcha and with a field for the senders email. Certainly, there is a header, "The user has sent you the following message.", limiting the use for spammers, so perhaps it's not a big problem. Any comments on what I'm doing will be greatly appreciated.

    Read the article

  • Problem using GDI+ with multiple threads (VB.NET)

    - by Joe B
    I think it would be best if I just copy and pasted the code (it's very trivial). Private Sub Main() Handles MyBase.Shown timer.Interval = 10 timer.Enabled = True End Sub Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint e.Graphics.DrawImage(image, 0, 0) End Sub Private Sub tick() Handles timer.Elapsed Using g = Graphics.FromImage(image) g.Clear(Color.Transparent) g.DrawLine(Pens.Red, 0 + i, 0 + i, Me.Width - i, Me.Height - i) End Using Me.Invalidate() End Sub An exception, "The object is currently in use elsewhere", is raised during the tick event. Could someone tell me why this happens and how to solve it? Thanks.

    Read the article

  • How to remove statusbar from messageviewcontroller?

    - by hckr
    I am sending sms programmatically from my view controller but now it is showing me statusbar and vertical black line my code: - (IBAction)SendTextBtnTapped:(id)sender { [self sendSMS:@"Body of SMS..." recipientList:[NSArray arrayWithObjects: nil]]; } - (void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients { MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init]; if([MFMessageComposeViewController canSendText]) { controller.body = bodyOfMessage; controller.recipients = recipients; controller.messageComposeDelegate = self; [self presentModalViewController:controller animated:YES]; } } - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result { [self dismissModalViewControllerAnimated:YES]; if (result == MessageComposeResultCancelled) NSLog(@"Message cancelled"); else if (result == MessageComposeResultSent) NSLog(@"Message sent"); else NSLog(@"Message failed"); } and my screen look like this:

    Read the article

  • How to link more than one object at a time in Xcode 4.2?

    - by Beppe
    I'm probably missing the basics here... Is there a way to link more than one object to a method at a time using Interface Builder in Xcode 4.2? I set tons of UIButtons in my UIView. All of them call just one method (let's say - (IBAction)buttonPushed:(UIButton *)aButton) that should do something different depending on the sender. I can't figure out a way to link them all with my method at a time. Any advice will be very appreciated... N.B. I'm using Xcode 4.2 on Snow Leopard, without storyboard.

    Read the article

  • Login screen using user custom control

    - by Mocco
    Hi, I have followed some advices I got here today and would need a bit more help now: I have an user control with login logic. In mainForm I am using this: private void Form1_Load(object sender, EventArgs e) { LoginScreen login = new MainMenu(); login.Parent = this; login.Dock = DockStyle.Fill; login.Show(); } But I guess it is not modal and thus does not stop the original Form application. Sure I would need the main Form to do not continue until the login form is closed (and login sucessfull). Would using an event correct? Let login object to raise an event that login was successfull and let the MainForm handle it - run the app?

    Read the article

  • How do I tell if the ObjectDataSource OnSelected event was called for the selectmethod or selectcou

    - by itchi
    I have an object datasource that looks like this: <asp:ObjectDataSource ID="obdsList" runat="server" EnablePaging="True" SelectCountMethod="GetCountByID" SortParameterName="sortExpression" OldValuesParameterFormatString="original_{0}" SelectMethod="GetByID" TypeName="Services.Users" onselected="obdsList_Selected"> <SelectParameters> <asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource> And a onselected event like this: protected void obdsList_Selected(object sender, ObjectDataSourceStatusEventArgs e) { } However, the event method is being called twice.. once with my returned list, and once with the returned Int32 count. If I want to cast e.ReturnValue to the return List how do I differentiate between the count and select methods? I can do a e.ReturnValue.GetType().ToString() but that seems like a hack.

    Read the article

  • Change the image height and width based on the scale?

    - by user281947
    I want to resize the image height and width after setting its scale, below is what i am doing : <Image x:Name="img" Source="sii.PNG" > <Image.RenderTransform> <ScaleTransform x:Name="scale" /> </Image.RenderTransform> </Image> below is the cs code : void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { scale.ScaleX = scale.ScaleY =e.NewValue; //here i have to change the height and width of an image }

    Read the article

  • Session State ArrayList in Shopping Cart ASP.NET

    - by user330342
    Hi guys, I'm creating a shopping cart application and I'm having some issues with implementing a session state for my arraylist. in my page load i declared if (Session["Cart"] == null) { Session["Cart"] = new ArrayList(); } else { ArrayList cart = (ArrayList)Session["Cart"]; } to create the session if it doesn't exist yet. then i have an event handler for a button to add items to the arraylist protected void onClick_AddBooking(object sender, EventArgs e) { int ClassID = Convert.ToInt32(Request.QueryString.Get("Class_Id")); ArrayList cart1 = new ArrayList(); cart1 = Session["Cart"]; cart1.Add(ClassID); i'm guessing i just don't know how to handle session states yet, thus the confusion. I'm essentially storing the class_ID then when the student confirms i'll store that to the DB and associate that ID with the Class Details. Thanks in advance guys!

    Read the article

  • Publish/Subscribe paradigm: Why must message classes not know about their subscribers?

    - by carleeto
    From Wikipedia: "Publish/subscribe (or pub/sub) is a messaging paradigm where senders (publishers) of messages are not programmed to send their messages to specific receivers (subscribers). Rather, published messages are characterized into classes, without knowledge of what (if any) subscribers there may be" I can understand why a sender must not be programmed to send its message to a specific receiver. But why must published messages be classes that do not have knowledge of their subscribers? It would seem that once the messaging system itself is in place, what typically changes as software evolves is the messages sent, the publishers and the receivers. Keeping the messages separate from the subscribers seems to imply that the subscription model might also change. Is this the reason? Also, does this occur in the real world? I realize this may be a basic question, but I'm trying to understand this paradigm and your replies are very much appreciated.

    Read the article

  • KeyDown event is not Working for Arrow keys ,Home , End ,Pageup,Pagedown and other similar keys in s

    - by Subhen
    Hi , I want to over ride the selection behaviour of listbox Items. We can traverse through listbox items using Up and Down arrows where as I wan to traverse the list using Left and Right arrow keys. While I am trying to add the key down event for Listbox, It shows almost all key presses except for Arrow Keys, Home, End and Similar keys. I have the following Code: private void listArtist_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key.ToString() == "Enter") { //Go to Some Page } else { MessageBox.Show(e.Key.ToString()); } } I am clue less about it. Please help. Thanks, Subhen

    Read the article

  • comparison between point and integer

    - by LawVS
    Right, basically I want to add two numbers together. It's for a working hours calculator and I've included parameters for a night shift scenario as an if statement. However, it now mucks up the day shift pattern. So I want to sort out that if the start time is below 12, then it'll revert to the original equation shown in the code instead of the if statement. -(IBAction)done:(id)sender { int result = [finishHours.text intValue] - [startHours.text intValue]; totalHours.text = [NSString stringWithFormat:@"%d", result]; if (result < 0) { totalHours.text = [NSString stringWithFormat:@"%d", result * -1]; } if (result < 12) { totalHours.text = [NSString stringWithFormat:@"%d", result + 24]; } if (startHours < 12) { totalHours.text = [NSString stringWithFormat:@"%d", result - 24]; }

    Read the article

  • ASP.NET - How can I cache user details for the duration of their visit?

    - by rockinthesixstring
    I've built a Repository that gets user details Public Function GetUserByOpenID(ByVal openid As String) As User Implements IUserRepository.GetUserByOpenID Dim user = (From u In dc.Users Where u.OpenID = openid Select u).FirstOrDefault Return user End Function And I'd like to be able to pull those details down IF the user is logged in AND IF the cached data is null. What is the best way to create a User object that contains all of the users details, and persist it across the entire site for the duration of their visit? I Was trying this in my Global.asax, but I'm not really happy using Session variables. I'd rather have a single object with all the details inside. Private Sub BaseGlobal_AcquireRequestState(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.AcquireRequestState If Session("UserName") Is Nothing AndAlso User.Identity.IsAuthenticated Then Dim repo As UrbanNow.Core.IUserRepository = New UrbanNow.Core.UserRepository Dim _user As New UrbanNow.Core.User _user = repo.GetUserByOpenID(User.Identity.Name) Session("UserName") = _user.UserName() Session("UserID") = _user.ID End If End Sub

    Read the article

  • asp.net web form Cutom Router Handler

    - by jparram
    I am using a custom route handler for a webforms application. I am using routes to determine localization. ie: if the url has es or fr in the route it will load either spanish or french resources. for example: www.someroute/es/checkstuff/checkstuff.aspx will load: www.someroute/checkstuff/checkstuff.aspx with the spanish resources. I am configuring the custom routes in global.asax via: protected void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } public static void RegisterRoutes(RouteCollection routes) { foreach (var value in _customRoutes) { routes.Add(value.RouteName, new Route(value.Route, new CustomRouteHandler(value.ResolvedRoute))); } } where _customroutes is a list of routes. Is there a way to do this with some kind of pattern matching so I can avoid adding a specific route for each page in the application. While I know I could use a t4 template to generate the routes, I guess I am looking for a dynamic way to create the list

    Read the article

  • How to measure how long is a function running?

    - by rhose87
    I want to see how long a function is running. So I added a timer object on my form and I came out with this code: private int counter = 0; //inside button click I have: timer = new Timer(); timer.Tick += new EventHandler(timer_Tick); timer.Start(); Result result = new Result(); result = new GeneticAlgorithms().TabuSearch(parametersTabu, functia); timer.Stop(); and: private void timer_Tick(object sender, EventArgs e) { counter++; btnTabuSearch.Text = counter.ToString(); } But this is not counting anything. Any ideas?

    Read the article

  • Which trick uses Apple to show icons in the dock contextual menu ?

    - by Matthieu Riegler
    My question is quite simple : To use a custom menu for the apps icon on the dock, - (NSMenu*) applicationDockMenu: (id) sender; of the NSApplicationDelegate has to return the menu that the dock will display. Using setImage on a NSMenuItem, you can normaly add icons to the menu. They show up on the normal menu, but not on in contextual menu of the app's dock icon. Then how did Apple manage QuickTime, XCode, Preview to show icons in the list of recent opened files accessible in their dock contextual menu ? Thx.

    Read the article

  • passing parameter to dowork?

    - by safi
    How can i Pass parameter to background_DoWork? public void bgw1_DoWork(Object sender, DoWorkEventArgs e) { make_zip_file argumentest = e.Argument as make_zip_file; Thread.Sleep(100); argumentest.return_path = argumentest.Makezipfile(files, IsOriginal); e.Result = argumentest; } i need to pass files,isOrginal parameter...? i am calling this method: public string run_async() { bgw1.DoWork += bgw1_DoWork; bgw1.RunWorkerCompleted += bgw1_RunWorkerCompleted; make_zip_file mzf2 = new make_zip_file(); bgw1.RunWorkerAsync(); return return_path; }

    Read the article

  • Gridview SortExpression with 2 fields

    - by aron
    Hello, I have a GridView that get's its datasource from a complex object. So I'm doing the Sorting & Paging in the code behind. <asp:GridView ID="SystemsDetailList" runat="server" AllowSorting="true" AllowPaging="true" AutoGenerateColumns="False" ShowFooter="True" OnPageIndexChanging="gridView_PageIndexChanging" OnSorting="gridView_Sorting"> For an important title column I have a SortExpression with 2 fields: SortExpression="FunctionalAreaDisplayCode, EswbsDisplayCode" This in the code behind: protected void gridView_Sorting(object sender, GridViewSortEventArgs e) { BindSystemList(e.SortExpression, sortOrder); } public string sortOrder { get { if (ViewState["sortOrder"].ToString() == "desc") { ViewState["sortOrder"] = "asc"; } else { ViewState["sortOrder"] = "desc"; } return ViewState["sortOrder"].ToString(); } set { ViewState["sortOrder"] = value; } } For some reason it will keep "FunctionalAreaDisplayCode" always sorted ASC but the EswbsDisplayCode works fine as it flips between ASC and DESC correctly. and tips here? thanks!

    Read the article

  • ASP.NET Radio Button State and Back Key

    - by Dave S
    When using the browser back key on a page with radio buttons and using auto-postback, the state of the buttons (checked) stays the same while other parts of the page do not. This results in a situation where button two is checked and the cached page (because of server-side logic) displays a message that button 1 is checked. What is the best way to handle this situation? The following code example exhibits this behavior: [Form:] <asp:RadioButton ID="rb1" runat="server" AutoPostBack="true" Text="Button1" OnCheckedChanged="rb_CheckedChanged" GroupName="rbgroup" Checked="true" /> <br /> <asp:RadioButton ID="rb2" runat="server" AutoPostBack="true" Text="Button2" OnCheckedChanged="rb_CheckedChanged" GroupName="rbgroup" /> <br /> <hr /> <asp:Label ID="lbl1" runat="server">Button 1</asp:Label> [Code Behind:] protected void rb_CheckedChanged(object sender, EventArgs e) { if (rb1.Checked == true) lbl1.Text = "Button 1"; else lbl1.Text = "Button 2"; }

    Read the article

  • use class in another windows form c# ???

    - by Chelsea_cole
    I have a problem in a same namespace: public partial class frmForm1 : Form // Form1 { public class Account { public string Username; public string Password; public string RePassword; public string Name; public string bd; public string dt; public string dc; } public class ListAcc { public static int count = 0; private static List<Account> UserList; public static List<Account> Data() { return UserList; } } } public partial class frmForm2 : Form // Form2 { private void button2_Click(object sender, EventArgs e) { ListAcc A; // error string n = A<Account>[0].Usename; // error // What should i do? } } Someone can help me fix this problem? Thanks alot!

    Read the article

  • Referencing a different project in the same assembly, different namespaces

    - by Redburn
    I have two projects : Menu and Module and they are both in the same namespace foobar. I am currently referencing the module project from the Menu project to open up certain controls on a tab control in my menu. However I need to launch a new control from one of my controls which is located in the Module project. When I try referencing the menu project, it does not show up in my intellisense when I try to reference it with a using. Am I doing something wrong logically here? Here is an example of what it is : Project Menu Public Void LaunchWPFControl(string pHeader,string pPath) { //Code goes here to launch a WPF control in the browser } Project Module //What I would love to do but doesn't work Using Menu; ... ... ... private void dgModule_MouseDoubleClick(object sender, MouseButtonEventArgs e) { Menu.LaunchWPFControl("Accounts","AccountsControl"); }

    Read the article

  • 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

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