Search Results

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

Page 33/174 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • C# Hotkey, Help?

    - by Di4g0n4leye
    namespace WebBrowser { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } int GetPixel(int x, int y) { Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppPArgb); Graphics grp = Graphics.FromImage(bmp); grp.CopyFromScreen(new Point(x,y), Point.Empty, new Size(1,1)); grp.Save(); return bmp.GetPixel(0, 0).ToArgb(); } void Button1Click(object sender, EventArgs e) { int x = Cursor.Position.X; int y = Cursor.Position.Y; int pixel = GetPixel(x,y); textBox1.Text = pixel.ToString(); } void MainFormLoad(object sender, EventArgs e) { webBrowser1.Navigate("http://google.com"); } } } } How i want to add a hotkey that call Button1 on Press? How can that be done?

    Read the article

  • delete row from selected gridview and database

    - by user175084
    i am trying to delete a row from the gridview and database... It should be deleted if a delte linkbutton is clicked in the gridview.. I am gettin the row index as follows: protected void LinkButton1_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; GridViewRow row = (GridViewRow)btn.NamingContainer; if (row != null) { LinkButton LinkButton1 = (LinkButton)sender; // Get reference to the row that hold the button GridViewRow gvr = (GridViewRow)LinkButton1.NamingContainer; // Get row index from the row int rowIndex = gvr.RowIndex; string str = rowIndex.ToString(); //string str = GridView1.DataKeys[row.RowIndex].Value.ToString(); RemoveData(str); //call the delete method } } now i want to delete it... so i am having problems with this code.. i get an error Must declare the scalar variable "@original_MachineGroupName"... any suggestions private void RemoveData(string item) { SqlConnection conn = new SqlConnection(@"Data Source=JAGMIT-PC\SQLEXPRESS; Initial Catalog=SumooHAgentDB;Integrated Security=True"); string sql = "DELETE FROM [MachineGroups] WHERE [MachineGroupID] = @original_MachineGroupID; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@original_MachineGroupID", item); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); } Blockquote <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SumooHAgentDBConnectionString %>" SelectCommand="SELECT MachineGroups.MachineGroupID, MachineGroups.MachineGroupName, MachineGroups.MachineGroupDesc, MachineGroups.TimeAdded, MachineGroups.CanBeDeleted, COUNT(Machines.MachineName) AS Expr1, DATENAME(month, (MachineGroups.TimeAdded - 599266080000000000) / 864000000000) + SPACE(1) + DATENAME(d, (MachineGroups.TimeAdded - 599266080000000000) / 864000000000) + ', ' + DATENAME(year, (MachineGroups.TimeAdded - 599266080000000000) / 864000000000) AS Expr2 FROM MachineGroups FULL OUTER JOIN Machines ON Machines.MachineGroupID = MachineGroups.MachineGroupID GROUP BY MachineGroups.MachineGroupID, MachineGroups.MachineGroupName, MachineGroups.MachineGroupDesc, MachineGroups.TimeAdded, MachineGroups.CanBeDeleted" DeleteCommand="DELETE FROM [MachineGroups] WHERE [MachineGroupID] =@original_MachineGroupID" > <DeleteParameters> <asp:Parameter Name="@original_MachineGroupID" Type="Int16" /> <asp:Parameter Name="@original_MachineGroupName" Type="String" /> <asp:Parameter Name="@original_MachineGroupDesc" Type="String" /> <asp:Parameter Name="@original_CanBeDeleted" Type="Boolean" /> <asp:Parameter Name="@original_TimeAdded" Type="Int64" /> </DeleteParameters> </asp:SqlDataSource> I still get an error : Must declare the scalar variable "@original_MachineGroupID"

    Read the article

  • Simple calculator app crashes when a third number key is punched.

    - by Justin
    Hi , I am a newbie to the iphone app world. So I thought I try my luck with a calculator app. Unfortunately I am running into an issue where if I press a third key in the calculator the app crashes. Sometimes I get this error EXC_BAD_ACCESS. Here is a code in my CalculatorViewController.m file. #import "CalculatorViewController.h" @implementation CalculatorViewController @synthesize screenText; - (IBAction)buttonPressed:(id)sender { NSString *title = [sender titleForState:UIControlStateNormal]; [self collect:title]; } - (void)collect:(NSString *)digitz { NSString * newText = nil; if ([digitz isEqualToString:@"+"]) { [self add:result]; big_digit = nil; } else if ([digitz isEqualToString:@"+"]) { [self sub:result]; } else if ([digitz isEqualToString:@"x"]) { [self multiply:result]; } else if ([digitz isEqualToString:@"="]) { [self equate:result]; } else { if (big_digit != nil && [big_digit isEqualToString:@"0"] == FALSE) big_digit = [big_digit stringByAppendingFormat:@"%@",digitz]; else big_digit = (NSMutableString *) digitz; result = (int) big_digit; newText = [[NSString alloc] initWithFormat: @"%@",big_digit]; } screenText.text = newText; [newText release]; } - (void)add:(int)res { NSString * newText = nil; ans = ans + res; newText = [[NSString alloc] initWithFormat: @"%@",ans]; screenText.text = newText; [newText release]; } Can anyone spot an obvious issue here. Here is the respective header file too. #import <UIKit/UIKit.h> @interface CalculatorViewController : UIViewController { UILabel *screenText; int number; int result; int ans; //NSString *big_digit; NSMutableString * big_digit ; } @property (nonatomic, retain) IBOutlet UILabel *screenText; - (IBAction)buttonPressed:(id)sender; - (void)collect:(NSString *)digitz; - (void)add:(int)num; - (void)sub:(int)num; - (void)multiply:(int)num; - (void)equate:(int)num; @end

    Read the article

  • Problem while adding a new value to a hashtable when it is enumerated

    - by karthik
    `hi I am doing a simple synchronous socket programming,in which i employed twothreads one for accepting the client and put the socket object into a collection,other thread will loop through the collection and send message to each client through the socket object. the problem is 1.i connect to clients to the server and start send messages 2.now i want to connect a new client,while doing this i cant update the collection and add a new client to my hashtable.it raises an exception "collection modified .Enumeration operation may not execute" how to add a NEW value without having problems in a hashtable. private void Listen() { try { //lblStatus.Text = "Server Started Listening"; while (true) { Socket ReceiveSock = ServerSock.Accept(); //keys.Clear(); ConnectedClients = new ListViewItem(); ConnectedClients.Text = ReceiveSock.RemoteEndPoint.ToString(); ConnectedClients.SubItems.Add("Connected"); ConnectedList.Items.Add(ConnectedClients); ClientTable.Add(ReceiveSock.RemoteEndPoint.ToString(), ReceiveSock); //foreach (System.Collections.DictionaryEntry de in ClientTable) //{ // keys.Add(de.Key.ToString()); //} //ClientTab.Add( //keys.Add( } //lblStatus.Text = "Client Connected Successfully."; } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void btn_receive_Click(object sender, EventArgs e) { Thread receiveThread = new Thread(new ThreadStart(Receive)); receiveThread.IsBackground = true; receiveThread.Start(); } private void Receive() { while (true) { //lblMsg.Text = ""; byte[] Byt = new byte[2048]; //ReceiveSock.Receive(Byt); lblMsg.Text = Encoding.ASCII.GetString(Byt); } } private void btn_Send_Click(object sender, EventArgs e) { Thread SendThread = new Thread(new ThreadStart(SendMsg)); SendThread.IsBackground = true; SendThread.Start(); } private void btnlist_Click(object sender, EventArgs e) { //Thread ListThread = new Thread(new ThreadStart(Configure)); //ListThread.IsBackground = true; //ListThread.Start(); } private void SendMsg() { while (true) { try { foreach (object SockObj in ClientTable.Keys) { byte[] Tosend = new byte[2048]; Socket s = (Socket)ClientTable[SockObj]; Tosend = Encoding.ASCII.GetBytes("FirstValue&" + GenerateRandom.Next(6, 10).ToString()); s.Send(Tosend); //ReceiveSock.Send(Tosend); Thread.Sleep(300); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }

    Read the article

  • asp.net web forms best practice to retrieve dynamic server control values

    - by Andrew Florko
    I populate web form with dynamic list of exams from database. I want user to enter examination marks for each exam. There is list of exam titles and textbox near each title. I create list with repeater control: <asp:Repeater ID="rptExams" runat="server" onitemdatabound="rptExams_ItemDataBound" > <ItemTemplate> <tr> <td> <asp:Literal runat="server" ID="ltTitle"/> </td> <td> <asp:HiddenField runat="server" ID="hfId"/> <asp:Textbox runat="server" ID="tbMark"/> </td> </tr> </ItemTemplate> </asp:Repeater> And bind data to repeater on page_init: class Exam { public int Id { get; set;} public string Title { get; set;} } ... // this list is retrieved from database actually Exam[] Exams = new Exam[] { new Exam { Id = 1, Title = "Math"}, new Exam { Id = 2, Title = "History"} }; ... protected void Page_Init(object sender, EventArgs e) { rptExams.DataSource = Exams; rptExams.DataBind(); } So far so good. Then I have to retrieve data on postback. I have two ways but both of them looks ugly. Idea is to store dynamically created databounded controls on ItemDataBoundEvent in Page_Init stage, and process their values in Page_Load stage. It looks like this: private Dictionary<HiddenField, TextBox> Id2Mark = new Dictionary<HiddenField, TextBox>(); protected void rptExams_ItemDataBound(object sender, RepeaterItemEventArgs e) { ... if (IsPostBack) { var tbMark = (TextBox)e.Item.FindControl("tbMark"); var hfId = (HiddenField)e.Item.FindControl("hfId"); // store dynamically created controls Id2Mark.Add(hfId, tbMark); } ... } protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { foreach (var pair in Id2Mark) { int examId = Int32.Parse(pair.Key.Value); string mark = pair.Value.Text; // PROCESS } ... I'm completely sure there is a better way to retrieve data from dynamically created controls. Thank you in advance!

    Read the article

  • Can anyone tell me what's wrong in this part of code

    - by Mobin
    string name = ((DateTimePicker)sender).Name.ToString(); name = name.Substring(0, name.Length - 1); name = name + "4"; TimeSpan duration = new TimeSpan(); duration = ((DateTimePicker)sender).Value - ((DateTimePicker)panel2.Controls[name]).Value; name = name.Substring(0, name.Length - 1); name = name + "6"; ((MaskedTextBox)panel2.Controls[name]).Text = duration.ToString(); On execution it gives me Object reference not set to instance of an object similar functionality is used on other places but I can't find out what I have to reinitialize here :$ The casting for datetimepicker is fine I have to get a name for the datetiempicker to identify the row it's on in my form and the picker before that to calculate their differences and then print that difference in a maskedtext box from the control whose name I make using names of two datetimepickers but when I access controls in the error line I get this message.

    Read the article

  • web service filling gridview awfully slow, as is paging/sorting

    - by nat
    Hi I am making a page which calls a web service to fill a gridview this is returning alot of data, and is horribly slow. i ran the svcutil.exe on the wsdl page and it generated me the class and config so i have a load of strongly typed objects coming back from each request to the many service functions. i am then using LINQ to loop around the objects grabbing the necessary information as i go, but for each row in the grid i need to loop around an object, and grab another list of objects (from the same request) and loop around each of them.. 1 to many parent object child one.. all of this then gets dropped into a custom datatable a row at a time.. hope that makes sense.... im not sure there is any way to speed up the initial load. but surely i should be able to page/sort alot faster than it is doing. as at the moment, it appears to be taking as long to page/sort as it is to load initially. i thought if when i first loaded i put the datasource of the grid in the session, that i could whip it out of the session to deal with paging/sorting and the like. basically it is doing the below protected void Page_Load(object sender, EventArgs e) { //init the datatable //grab the filter vars (if there are any) WebServiceObj WS = WSClient.Method(args); //fill the datatable (around and around we go) foreach (ParentObject po in WS.ReturnedObj) { var COs = from ChildObject c in WS.AnotherReturnedObj where c.whatever.equals(...) ...etc foreach(ChildObject c in COs){ myDataTable.Rows.Add(tlo.this, tlo.that, c.thisthing, c.thatthing, etc......); } } grdListing.DataSource = myDataTable; Session["dt"] = myDataTable; grdListing.DataBind(); } protected void Listing_PageIndexChanging(object sender, GridViewPageEventArgs e) { grdListing.PageIndex = e.NewPageIndex; grdListing.DataSource = Session["dt"] as DataTable; grdListing.DataBind(); } protected void Listing_Sorting(object sender, GridViewSortEventArgs e) { DataTable dt = Session["dt"] as DataTable; DataView dv = new DataView(dt); string sortDirection = " ASC"; if (e.SortDirection == SortDirection.Descending) sortDirection = " DESC"; dv.Sort = e.SortExpression + sortDirection; grdListing.DataSource = dv.ToTable(); grdListing.DataBind(); } am i doing this totally wrongly? or is the slowness just coming from the amount of data being bound in/return from the Web Service.. there are maybe 15 columns(ish) and a whole load of rows.. with more being added to the data the webservice is querying from all the time any suggestions / tips happily received thanks

    Read the article

  • Delphi 2010 " is" statement behaves differently than Delphi 7's?!

    - by Tom1952
    Why does the code below return TRUE in Delphi 7 and FALSE in Delphi 2010? TBitBtn is a descendant of TButton. type TForm1 = class(TForm) Button1: TButton; BitBtn1: TBitBtn; procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.dfm} procedure TestControl( aControl: TControl); begin if (aControl is TButton) then showmessage('TRUE') else showmessage('FALSE'); end; procedure TForm1.Button1Click(Sender: TObject); begin TestControl(BitBtn1); end;

    Read the article

  • Please Find the error :

    - by jagdeep
    using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class Expt : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Bttnadd_Click(object sender, EventArgs e) { FileUpload1.SaveAs(MapPath("~/img//"+DateTime.Now.ToString()+FileUpload1.FileName)); } } Exception Details: System.Web.HttpException: ~/img//1/1/2011 1:47:52 PMWinter.jpg is not a valid virtual path.

    Read the article

  • error with string list in C#

    - by Chelsea_cole
    Same namespace: 2 forms. public class Account //frm1 { public string Username; public string Password; } public class ListAcc { public static List<Account> UserList; } private void button1_Click(object sender, EventArgs e) { List<Account> UserList = new List<Account>(); Account acc = new Account(); acc.Username = textBox1.Text; acc.Password = textBox2.Text; UserList.Add(acc); } private void button2_Click(object sender, EventArgs e) //frm2 { string p = frmDangky.ListAcc.UserList[0].Username; // null ->error string p = frmDangky.ListAcc.UserList[0].Password; // null ->error } Someone help me? :( why my string is NULL???????? The textBox is not empty... Thanks!

    Read the article

  • RadioButton checkedchanged event firing multiple times

    - by kash3
    Hi, I am trying to add multiple radiobutton columns to my gridview dynamically in the code and i want to implement some logic which involves database fetch in the checkedchanged event of radiobuttons but some how the checked changed event is being fired multiple times for each row. Following is the code: aspx: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CC9966" BorderStyle="None" EnableViewState="true" BorderWidth="1px" CellPadding="4" Font-Names="Verdana"> <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" /> <Columns> <asp:TemplateField HeaderText="Select One"> <ItemTemplate> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Select Two"> <ItemTemplate> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <asp:Label ID="lblval" runat="server" Text="!" ForeColor="Red" Visible="false"/> </ItemTemplate> </asp:TemplateField> </Columns> **code behind** void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.DataItem != null) { DataRowView dvRowview = (DataRowView)e.Row.DataItem; int currentRow = GridView1.Rows.Count; RadioButton rdoSelect1 = new RadioButton(); rdoSelect1.GroupName = "Select" + currentRow; rdoSelect1.ID = string.Concat("rdoSelect1", currentRow); rdoSelect1.AutoPostBack = true; rdoSelect1.CheckedChanged += new EventHandler(rdoSelect_CheckedChanged); e.Row.Cells[0].Controls.Add(rdoSelect1); RadioButton rdoSelect2 = new RadioButton(); rdoSelect2.GroupName = "Select" + currentRow; rdoSelect2.ID = string.Concat("rdoSelect2", currentRow); rdoSelect2.AutoPostBack = true; rdoSelect2.CheckedChanged += new EventHandler(rdoSelect_CheckedChanged); e.Row.Cells[1].Controls.Add(rdoSelect2); if (!IsPostBack) { e.Row.Cells[e.Row.Cells.Count - 1].Controls[1].Visible = false; if (e.Row.Cells[0] != null && Convert.ToBoolean(dvRowview["Select1"]) == true) rdoSelect1.Checked = true; else rdoSelect1.Checked = false; if (e.Row.Cells[0] != null && Convert.ToBoolean(dvRowview["Select2"]) == true) rdoSelect2.Checked = true; else rdoSelect2.Checked = false; } } } void rdoSelect_CheckedChanged(object sender, EventArgs e) { RadioButton rdoSelectedOption = (RadioButton)sender; GridViewRow selRow = rdoSelectedOption.NamingContainer as GridViewRow; if (rdoSelectedOption.Checked) selRow.Cells[selRow.Cells.Count - 1].Controls[1].Visible = true; else selRow.Cells[selRow.Cells.Count - 1].Controls[1].Visible = false; } i want the checkedchanged event to fire only once for a group name and row.

    Read the article

  • ASP.NET data bind two-way, bi-directional from code behind

    - by Konrad
    Hello, so for two-way (bi-directional) databinding in ASP, we do this... <asp:textbox id="txtField" runat="server" text='<%# Bind("SomeField") %>'> </asp:textbox> SomeField is located on the DataSource of the DetailsView that serves as the container for the textbox. Alternatively I could do this from code-behind (using the textbox's OnDataBinding event): protected void SomeField_OnDataBinding(object sender, EventArgs e) { ((TextBox)sender).Text = Eval("SomeField").ToString(); } However, EVAL is read-only...how can I specify Bind (two-way) from code-behind?

    Read the article

  • using Label control to create looping marquee text in c# winform

    - by hanmyint
    I have been create Marquee text using Label control her is sample code public partial class FrmMarqueeText : Form { private int xPos = 0, YPos = 0; public FrmMarqueeText() { InitializeComponent(); } private void FrmMarqueeText_Load(object sender, EventArgs e) { lblText.Text = "Hello this is marquee text"; xPos = lblText.Location.X; YPos = lblText.Location.Y; timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { if (xPos == 0) { this.lblText.Location = new System.Drawing.Point(this.Width, YPos); xPos = this.Width; } else { this.lblText.Location = new System.Drawing.Point(xPos, YPos); xPos -= 2; } } but when the first time was finished, it didn't continues work .Please help me!

    Read the article

  • adding Buttons to Columns in Datagride view

    - by kasunmit
    HiHi, I wrote C# application for import unread e-mails from outlook 2007, I could import sender name, sender mail address,subject and body to data grid view as following foreach (Microsoft.Office.Interop.Outlook._MailItem mailItem in fldEmails.Items) { if (mailItem.UnRead) { UnreadEmails mail = new UnreadEmails(); // mail.AttachmentContent = (mailItem.UnRead == false) ? string.Empty : mailItem.Attachments.Session.OpenSharedItem; foreach (Microsoft.Office.Interop.Outlook.Attachment Atmt in mailItem.Attachments) { mail.AttachmentContent = (mailItem.UnRead == false) ? string.Empty : Atmt.DisplayName; } emails.Add(mail); } } UnreadEmails is a separte class. but couldn't find a way to import attachments (word pdf ppt excel) because i need it for my filter pls help me about it but i could import inly name of the attachment but i need to import attachment content (word, pdf , ppt .. atc. ) to this data grid pls tell how i can do it ... with the code

    Read the article

  • UISegemnted COntrol - selecting 3rd segment activates second segment

    - by diggers25
    I have a segmented control with 3 defined segments. i am looking to capture the segment index so I can use it in an if statement to update variables accordingly as such: -(IBAction)numPlayers:(id)sender; { numPlayersSegment = [(UISegmentedControl *)sender retain]; if (numPlayersSegment.selectedSegmentIndex == 0) { numOfPlayers = 2; } else if (numPlayersSegment.selectedSegmentIndex = 1) { numOfPlayers = 3; } else if (numPlayersSegment.selectedSegmentIndex = 2) { numOfPlayers = 4; } else if (numPlayersSegment.selectedSegmentIndex = -1) { numOfPlayers = 0; } NSLog(@"Players selected = %d", numPlayersSegment.selectedSegmentIndex); However whenever I press the third segment (index 2) it returns the value of the second segment (index 1) and also highlights the 2nd segment. I can see nothing untoward in IB. Has anybody seen this and have any suggestions. I am using xcode 3.2.1 on snow leopard thanks

    Read the article

  • saving appengine mail from spam filters

    - by Fh
    One of my clients uses Trend Micro InterScan Messaging Security to protect their internal mail services. Suddenly InterScan decided to filter out all messages coming from Google App Engine. Unfortunately they haven't been able to whitelist the sender address as each e-mail gets a different one. For example, *3ckihSOVMMHlZHSL.JSMMHlZHSL.JS*@apphosting.bounces.google.com, with everything before the @ being variable. Update I'm including this screenshot of how Interscan sees the incoming e-mail. Notice that all senders are different: If I look into the e-mail headers, the apphosting domain appears inside the Return-Path field: Return-Path: <36kSiSwYIBh0883XL3E7.5EH883XL3E7.5E@apphosting.bounces.google.com> The "From" field looks ok. It says what I set it to say, but the spam filter only looks at the Return-Path. My client sysadmin doesn't want to whitelist the whole apphosting domain, as it wouldn't be only whitelisting my application. How could I bypass this e-mail filters if I can't get an unique sender? Thanks,

    Read the article

  • about the post_save signal and created argument

    - by panchicore
    the docs says: post_save django.db.models.signals.post_save created A boolean; True if a -new- record was create. and I have this: from django.db.models.signals import post_save def handle_new_user(sender, instance, created, **kwargs): print "--------> save() "+str(created) post_save.connect(handle_new_user, sender=User) when I do in shell: u = User(username="cat") u.save() >>> --------> save() True u.username = "dog" u.save() >>> --------> save() True I expect a -------- save() False when I save() the second time because is an update? not?

    Read the article

  • Not getting redirection to custom error page using custom errors - ASP.Net

    - by weevie
    Here's my Application_OnError event sink in global.asax.vb: Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs) Dim innerMostException As Exception = getInnerMostException(Me.Context.Error) If TypeOf innerMostException Is AccessDeniedException Then Security.LogAccessDeniedOccurrence(DirectCast(innerMostException, AccessDeniedException)) Dim fourOhThree As Integer = DirectCast(HttpStatusCode.Forbidden, Integer) Throw New HttpException(fourOhThree, innerMostException.Message, innerMostException) End If End Sub You'll see that if we've got an innermost Exception of type AccessDeniedException we throw a new HTTPExcpetion with a status code of 403 AKA 'forbidden' Here's the relevant web.config entry: <customErrors defaultRedirect="~/Application/ServerError.aspx" mode="On"> <error statusCode="403" redirect="~/Secure/AccessDenied.aspx" /> </customErrors> So what we're expecting is a redirect to the AccessDenied.aspx page. What we get is a redirect to the ServerError.aspx page. We've also tried this: Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs) Dim innerMostException As Exception = getInnerMostException(Me.Context.Error) If TypeOf innerMostException Is AccessDeniedException Then Security.LogAccessDeniedOccurrence(DirectCast(innerMostException, AccessDeniedException)) Context.Response.StatusCode = DirectCast(HttpStatusCode.Forbidden, Integer) End If End Sub Which unsuprisingly doesn't work either. Any ideas what we're doing wrong?

    Read the article

  • Compile error on action for iPhone app: "error:expected ')' before ';' token"

    - by Jamis Charles
    I'm working through the tutorials in the "Beginning iPhone Development" book. I'm on chapter 4 and I'm getting the following compile error on the "if (segment == kShowSegmentIndex)" line: error:expected ')' before ';' token Here's my code: - (IBAction)toggleShowHide:(id)sender{ UISegmentedControl *segmentedControl = (UISegmentedControl *)sender; NSInteger segment = segmentedControl.selectedSegmentIndex; if (segment == kShowSegmentIndex) [switchView setHidden:NO]; else [switchView setHidden:YES]; } I've compared it with the code in the book several times and have retyped it. Sounds like this error is caused by improper brace placement. Any thoughts?

    Read the article

  • c# event fires windows form incorrectly

    - by MikeW
    I'm trying to understand what's happening here. I have a CheckedListBox which contains some ticked and some un-ticked items. I'm trying to find a way of determining the delta in the selection of controls. I've tried some cumbersome like this - but only works part of the time, I'm sure there's a more elegant solution. A maybe related problem is the myCheckBox_ItemCheck event fires on form load - before I have a chance to perform an ItemCheck. Here's what I have so far: void clbProgs_ItemCheck(object sender, ItemCheckEventArgs e) { // i know its awful System.Windows.Forms.CheckedListBox cb = (System.Windows.Forms.CheckedListBox)sender; string sCurrent = e.CurrentValue.ToString(); int sIndex = e.Index; AbstractLink lk = (AbstractLink)cb.Items[sIndex]; List<ILink> _links = clbProgs.DataSource as List<ILink>; foreach (AbstractLink lkCurrent in _links) { if (!lkCurrent.IsActive) { if (!_groupValues.ContainsKey(lkCurrent.Linkid)) { _groupValues.Add(lkCurrent.Linkid, lkCurrent); } } } if (_groupValues.ContainsKey(lk.Linkid)) { AbstractLink lkDirty = (AbstractLink)lk.Clone(); CheckState newValue = (CheckState)e.NewValue; if (newValue == CheckState.Checked) { lkDirty.IsActive = true; } else if (newValue == CheckState.Unchecked) { lkDirty.IsActive = false; } if (_dirtyGroups.ContainsKey(lk.Linkid)) { _dirtyGroups[lk.Linkid] = lkDirty; } else { CheckState oldValue = (CheckState)e.NewValue; if (oldValue == CheckState.Checked) { lkDirty.IsActive = true; } else if (oldValue == CheckState.Unchecked) { lkDirty.IsActive = false; } _dirtyGroups.Add(lk.Linkid, lk); } } else { if (!lk.IsActive) { _dirtyGroups.Add(lk.Linkid, lk); } else { _groupValues.Add(lk.Linkid, lk); } } } Then onclick of a save button - I check whats changed before sending to database: private void btSave_Click(object sender, EventArgs e) { List<AbstractLink> originalList = new List<AbstractLink>(_groupValues.Values); List<AbstractLink> changedList = new List<AbstractLink>(_dirtyGroups.Values); IEnumerable<AbstractLink> dupes = originalList.ToArray<AbstractLink>().Intersect(changedList.ToArray<AbstractLink>()); foreach (ILink t in dupes) { MessageBox.Show("Changed"); } if (dupes.Count() == 0) { MessageBox.Show("No Change"); } } For further info. The definition of type AbstractLink uses: public bool Equals(ILink other) { if (Object.ReferenceEquals(other, null)) return false; if (Object.ReferenceEquals(this, other)) return true; return IsActive.Equals(other.IsActive) && Linkid.Equals(other.Linkid); }

    Read the article

  • Find the right parameters for an event without using Design Mode in Visual Studio 2010

    - by Jason
    Is there a way to know what parameters are needed by an event in Visual Studio 2010? Let's say I have a DropDownList control and I want to bind a method to the "OnSelectedIndexChanged", I would do something like this In the ASPX File: <asp:DropDownList ID="lstMyList" runat="server" OnSelectedIndexChanged="lstMyList_SelectedIndexChanged"></asp:DropDownList> In the codebehind: protected void lstMyList_SelectedIndexChanged(object sender, EventArgs e) { ... } Is there a way to know what parameters the method needs? (In this case, an object for the sender and an EventArgs parameter for the event.) I know you can easily create the method by double-clicking the right event in Design Mode, but it does a mess with your code so I prefer not to use it. Thanks!

    Read the article

  • Need ILMerge hint

    - by lakhlaniprashant.blogspot.com
    Hi all, I'm trying to merge vintasoft barcode sdk with my data access dll and it's not working after ilmerge. Any ideas are welcome here is the error: IndexOutOfRangeException: Index was outside the bounds of the array.] 2.+.©(Byte[] param0) in :0 2.+..cctor() in :0 [TypeInitializationException: The type initializer for '2.+' threw an exception.] 2.+.¥S() in :0 Vintasoft.Barcode.WriterSettings..cctor() in :0 [TypeInitializationException: The type initializer for 'Vintasoft.Barcode.WriterSettings' threw an exception.] Vintasoft.Barcode.WriterSettings..ctor() in :0 Vintasoft.Barcode.BarcodeWriter..ctor() in :0 _Default.buttonGenerateBarcode_Click(Object sender, EventArgs e) in E:\ILMergeSample\WebBarcodeWriterDemo\QRBarcode.aspx.vb:27 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 Thanks in advance

    Read the article

  • ASP.NET Application Level vs. Session Level and Global.asax...confused

    - by contactmatt
    The following text is from the book I'm reading, 'MCTS Self-Paced Training Kit (Exam 70-515) Web Applications Development with ASP.NET 4". It gives the rundown of the Application Life Cycle. A user first makes a request for a page in your site. The request is routed to the processing pipeline, which forwards it to the ASP.NET runtime. The ASP.NET runtime creates an instance of the ApplicationManager class; this class instance represents the .NET framework domain that will be used to execute requests for your application. An application domain isolates global variables from other applications and allows each application to load and unload separately, as required. After the application domain has been created, an instance of the HostingEnvironment class is created. This class provides access to items inside the hosting environment, such as directory folders. ASP.NET creates instances of the core objects that will be used to process the request. This includes HttpContext, HttpRequest, and HttpResponse objects. ASP.NET creates an instance of the HttpApplication class (or an instance is reused). This class is also the base class for a site’s Global.asax file. You can use this class to trap events that happen when your application starts or stops. When ASP.NET creates an instance of HttpApplication, it also creates the modules configured for the application, such as the SessionStateModule. Finally, ASP.NET processes request through the HttpApplication pipleline. This pipeline also includes a set of events for validating requests, mapping URLs, accessing the cache, and more. The book then demonstrated an example of using the Global.asax file: <script runat="server"> void Application_Start(object sender, EventArgs e) { Application["UsersOnline"] = 0; } void Session_Start(object sender, EventArgs e) { Application.Lock(); Application["UsersOnline"] = (int)Application["UsersOnline"] + 1; Application.UnLock(); } void Session_End(object sender, EventArgs e) { Application.Lock(); Application["UsersOnline"] = (int)Application["UsersOnline"] - 1; Application.UnLock(); } </script> When does an application start? Whats the difference between session and application level? I'm rather confused on how this is managed. I thought that Application level classes "sat on top of" an AppDomain object, and the AppDomain contained information specific to that Session for that user. Could someone please explain how IIS manages Applicaiton level classes, and how an HttpApplication class sits under an AppDomain? Anything is appreciated.

    Read the article

  • How to animate a UIButton selected background Image

    - by Thomas Joos
    hi all, I have a class defining a custom UIButton. I configurate a normal and selected state like this: //custom image UIImage *image = [UIImage imageNamed:@"customIconCreationBG.png"]; UIImage *stretchImage = [image stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0]; [self setBackgroundImage:stretchImage forState:UIControlStateNormal]; UIImage *imageSelected = [UIImage imageNamed:@"customIconCreationBG_selected.png"]; UIImage *stretchImageSelected = [imageSelected stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0]; [self setBackgroundImage:stretchImageSelected forState:UIControlStateSelected]; In another class I'm filling an array with custom buttons and i'm adding a button pressed method. It sets the selected state to TRUE -(void)buttnPressed:(id)sender { NSLog(@"button pressed"); [[NSNotificationCenter defaultCenter] postNotificationName:@"unselectBGIcons" object:self]; HorizontalListIcon *pressedIcon = ((HorizontalListIcon *)sender); [pressedIcon setSelected:TRUE]; } The button switches to another background, which is great. Is there a way to animate this change ( fading in? ) because it's a bit hard now. Greets

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >