Search Results

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

Page 52/174 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • Custom authentication module inheriting IHttpModule issue.

    - by Chandan Khatwani
    LoginPage.aspx:- protected void Button1_Click(object sender, EventArgs e) { Context.Items["Username"] = txtUserId.Text; Context.Items["Password"] = txtPassword.Text; // FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, Context.Items["Username"].ToString(), DateTime.Now, DateTime.Now.AddMinutes(10), true, "users", FormsAuthentication.FormsCookiePath); // Encrypt the cookie using the machine key for secure transport string hash = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie( FormsAuthentication.FormsCookieName, // Name of auth cookie hash); // Hashed ticket // Set the cookie's expiration time to the tickets expiration time if (ticket.IsPersistent) cookie.Expires = ticket.Expiration; Response.Cookies.Add(cookie); Response.Redirect("Default.aspx"); } Global.asax file:- void Application_AuthenticateRequest(object sender, EventArgs e) { if (HttpContext.Current.User != null) { if (HttpContext.Current.User.Identity.IsAuthenticated) { if (HttpContext.Current.User.Identity is FormsIdentity) { FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity; FormsAuthenticationTicket ticket = id.Ticket; // Get the stored user-data, in this case, our roles string userData = ticket.UserData; string[] roles = userData.Split(','); HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(id, roles); Response.Write(HttpContext.Current.User.Identity.Name); Response.Redirect("Default.aspx"); } } } } I get the following error after signing in This webpage has a redirect loop. The webpage at http://localhost:1067/Default.aspx has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

    Read the article

  • session variables in an ASP.NET

    - by Beep
    hi guy i am trying to place my session in to a drop down, any help would be great. at the moment it puts the data in to a label, i wish to put it into a dropdown with it adding a new string every time i click button without getting rid of the last default page protected void Button1_Click1(object sender, EventArgs e) { Session["Fruitname"] = TbxName.Text; // my session i have made } output page protected void Page_Load(object sender, EventArgs e) { var fruitname = Session["Fruitname"] as String; // my session ive made fruit.Text = fruitname; // session used in lable } Have Tried var myFruits = Session["Fruitname"] as List<string>; myFruits.Add(listbox1.Text); but i get error when i try to run the program Broken glass thanks for your help, it is still not doing what i need but its getting there. var fruitname = Session["Fruitname"] as String; // my session ive made fruit.Text = string.Join(",", fruitname); // session used in lable this is what is working. i need a dropdown to display all the strings put into TbxName.Text; to output into fruit

    Read the article

  • Dynamically showing TableView or DetailView

    - by Niels
    From my TableView I dynamically want to show either a TableView or a DetailView (new segue), based on the cell's content. I setup two segues from the TableView to different DetailViews and one segue from the TableViewCell to the TableView. I have almost completed the implementation using performSegueWithIdentifier: (see below), but there is one struggling issue remaining: after I call [self dismissModalViewControllerAnimated:YES]; on the DetailView it returns to an empty TableView . I assume because the Storyboard segue from the UITableViewCell is performed. By clicking the back button I return to my original (parent) TableView data. Any suggestions for this work? - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSLog(@"%s", __PRETTY_FUNCTION__); NSString *type = [[self.dataController objectInListAtIndex:[self.tableView indexPathForSelectedRow].row] valueForKey:@"cell_type"]; NSLog(@"cell_type: %@", type); if([[segue identifier] isEqualToString:@"DetailSegue"]) { UIViewController *detailViewController = [segue destinationViewController]; detailViewController.game = [self.dataController objectInListAtIndex:[self.tableView indexPathForSelectedRow].row]; } else if ... } else if([[segue identifier] isEqualToString:@"TableViewSegue"]){ if([type isEqualToString:@"TableView"]){ //Create child ViewController, a custom ViewController with custom initWithId:Title: CategoryViewController *categoryViewController = [[segue destinationViewController] initWithId:categoryId Title:categoryTitle]; } } }

    Read the article

  • Extra NotifyIcon shown in system tray

    - by Kettch19
    I'm having an issue with an app where my NotifyIcon displays an extra icon. The steps to reproduce it are easy, but the problem is that the extra icon shows up after any of the actual codebehind we've added fires. Put simply, clicking a button triggers execution of method FooBar() which runs all the way through fine but its primary duty is to fire a backgroundworker to log into another of our apps. It only appears if this particular button is clicked. Strangely enough, we have a WndProc method override and if I step through until the extra NotifyIcon appears, it always appears during this method so something else beyond the codebehind must be triggering the behavior. Our WndProc method is currently (although I don't think it's caused by the WndProc): Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) 'Check for WM_COPYDATA message from other app or drag/drop action and handle message If m.Msg = NativeMethods.WM_COPYDATA Then ' get the standard message structure from lparam Dim CD As NativeMethods.COPYDATASTRUCT = m.GetLParam(GetType(NativeMethods.COPYDATASTRUCT)) 'setup byte array Dim B(CD.cbData) As Byte 'copy data from memory into array Runtime.InteropServices.Marshal.Copy(New IntPtr(CD.lpData), B, 0, CD.cbData) 'Get message as string and process ProcessWMCopyData(System.Text.Encoding.Default.GetString(B)) 'empty array Erase B 'set message result to 'true', meaning message handled m.Result = New IntPtr(1) End If 'pass on result and all messages not handled by this app MyBase.WndProc(m) End Sub The only place in the code where the NotifyIcon in question is manipulated at all is in the following event handler (again, don't think this is the culprit, but just for more info): Private Sub TrayIcon_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TrayIcon.MouseDoubleClick If Me.Visible Then Me.Hide() Else PositionBottomRight() Me.Show() End If End Sub The backgroundworker's DoWork is as follows (just a class call to log in to our other app, but again just for info): Private Sub LoginBackgroundWorker_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles LoginBackgroundWorker.DoWork Settings.IsLoggedIn = _wdService.LogOn(Settings.UserName, Settings.Password) End Sub Does anyone else have ideas on what might be causing this or how to possibly further debug this? I've been banging my head on this without seeing a pattern so another set of eyes would be extremely appreciated. :) I've posted this on MSDN winforms forums as well and have had no luck there so far either.

    Read the article

  • Problem in calling a function from different class using protocols-iphone

    - by Muniraj
    I use cocos2d for my game. In which I play a movie and have a separate overlay view for controls.The touches are detected in the overlay view. Now when the touches are detected the function in the game code has to be invoked. But the function is not detected and there is no error. I dont know what has gone wrong. Someone please help me. The code are as follows The protocol part is @protocol Protocol @required -(void) transition1:(id) sender; @end The function which is to be invoked in the game code is (void) transition1:(id) sender { [[Director sharedDirector] replaceScene: [ [Scene node] addChild: [Layer4 node] z:0] ]; } The code in the overlay view in MovieOverlayViewController.h import "Protocol.h" @interface MovieOverlayViewController : UIViewController { UIImageView *overlay; NSObject <Protocol> *transfer; } @end The code in the overlay view in MovieOverlayViewController.m @implementation MovieOverlayViewController (id)init { if ((self = [super init])) self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease]; return self; } -(void) viewWillAppear:(BOOL)animated { overlay = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"overlay.png"]] autorelease]; [self.view addSubview:overlay]; } (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint point = [touch locationInView:self.view]; NSLog(@"pointx: %f pointy:%f", point.x, point.y); if (CGRectContainsPoint(CGRectMake(1, 440, 106, 40), point)) { // the function is called here [transfer transition1: nil]; } else if (CGRectContainsPoint(CGRectMake(107, 440, 106, 40), point)) NSLog(@"tab 2 touched"); } (void)dealloc { [overlay release]; [super dealloc]; } @end

    Read the article

  • Getting values from another winform and passing it to current!

    - by klm9971
    Hello: I have 2 windows forms. The 1st one who gets active during start of the program has a button in which another 2nd windows form appears which has text field in which user type their name and HIT okay. Now in the 1st form I have a variable name: nameproccessed which takes the name from the second form. But the problem is my button which is in the 1st form has more functions besides taking name, how can I stop the flow of the compiler to take first the name from the second form and then process the rest execution of the function??? Here is the snippet of my code: //1st form //Class1 public string _nameProcessed = ""; private void btnGetSomething_Click(object sender, EventArgs e) { showdial(); //some more functionalities in this function!!! } private void showdial() { InputName inm = new InputName(); inm.Show(); } //2nd form //Class2 public string name; private void btnEnterName_Click(object sender, EventArgs e) { name = tbxName.Text; Class1 ict = new Class1(); ict._nameProcessed = name; this.Close(); } Now I want to take the 'name' from the second form put it on the _nameprocessed in the 1st form and then execute the rest of the function. How can I do that? Any help!

    Read the article

  • Where do I control the behavior of the "X" close button in the upper right of a winform?

    - by John at CashCommons
    I'm venturing into making my VB.NET application a little better to use by making some of the forms modeless. I think I've figured out how to use dlg.Show() and dlg.Hide() instead of calling dlg.ShowDialog(). I have an instance of my modeless dialog in my main application form: Public theModelessDialog As New dlgModeless To fire up the modeless dialog I call theModelessDialog.Show() and within the OK and Cancel button handlers in dlgModeless I have Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Hide() End Sub Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Hide() End Sub and that seems to work fine. The "X" button in the upper right is getting me, though. When I close the form with that button, then try to reopen the form, I get ObjectDisposedException was unhandled. Cannot access a disposed object. I feel like I'm most of the way there but I can't figure out how to do either of the following: Hide that "X" button Catch the event so I don't dispose of the object (just treat it like I hit Cancel) Any ideas? The class of this dialog is System.Windows.Forms.Form. Thanks as always!

    Read the article

  • csharp get value datatemplate element

    - by To-me
    Hello, Here is my code <ListBox x:Name="myList" IsSynchronizedWithCurrentItem="True" SelectionChanged="editElement"> <ListBox.ItemTemplate> <DataTemplate x:Name="ElementItemTemplate"> <StackPanel Name="stackPanelElementItem" Orientation="Horizontal"> <Label Name="SelectedItemlabel" Content="{Binding}" /> <Button Name="buttonDelElement" Click="btnDelElement">Delete</Button> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> private void btnDelElement(object sender, RoutedEventArgs e) { ListBoxItem lbi2 = (ListBoxItem)(lstCursus.ItemContainerGenerator.ContainerFromItem(myList.Items.CurrentItem)); String selectedItem = lbi2.Content.ToString(); MessageBox.Show("Selected Item " + selectedItem + " ."); private void editCursus(object sender, RoutedEventArgs e) { MessageBox.Show("Selected Item " + selectedItem + " ."); /* some code to edit selected item using linq */ } My issue, SelectionChange doesn't work anymore and when I click on buttonDelElement, Selected Item doesn't change immediately. Please, any ideas?

    Read the article

  • Open new UserControl in the mainWindows

    - by user287964
    Hi I have this snippet public partial class Window1 : Window { public Window1() { InitializeComponent(); } private void ToggleButton_Checked(object sender, RoutedEventArgs e) { switch ((sender as Button).Content.ToString()) { case "UserControl 1": AddItemToContainer(new UserControl1()); break; case "UserControl 2": AddItemToContainer(new UserControl2()); break; case "UserControl 3": AddItemToContainer(new UserControl3()); break; default: break; } } void AddItemToContainer(UIElement _myElement) { Grid.SetColumn(_myElement, 1); HostContainer.Children.Add(_myElement); } } } } With this I can open a new userControl in myMainwindow Let’s say something like adding child to myMainWinodw,Now I’m trying to click on a button from my userControl so I open another userControl that take the place of the first one I explain: I have the mainWindows it has 3 button first one to open the first UserControl the second one to open the second userControl and the third to open the last UserControl,imagine that I opened the first UserControl let’s call it UC1, In the UC1 I have a button to open the second userControl (let’s call it UC2) I like that when I clik the button from the UC1 the UC2 is opened and take the place of the UC1 (of course the UC2 is still a child of myMainWinodw) I have alredy try to call the AddItemToContainer methode from other methode but nothing is happened Any suggestion please

    Read the article

  • How to avoid raising an event to a closed form?

    - by Steve Dignan
    I'm having trouble handling the scenario whereby an event is being raised to a closed form and was hoping to get some help. Scenario (see below code for reference): Form1 opens Form2 Form1 subscribes to an event on Form2 (let's call the event FormAction) Form1 is closed and Form2 remains open Form2 raises the FormAction event In Form1.form2_FormAction, why does this return a reference to Form1 but button1.Parent returns null? Shouldn't they both return the same reference? If we were to omit step 3, both this and button1.Parent return the same reference. Here's the code I'm using... Form1: public partial class Form1 : Form { public Form1 () { InitializeComponent(); } private void button1_Click ( object sender , EventArgs e ) { // Create instance of Form2 and subscribe to the FormAction event var form2 = new Form2(); form2.FormAction += form2_FormAction; form2.Show(); } private void form2_FormAction ( object o ) { // Always returns reference to Form1 var form = this; // If Form1 is open, button1.Parent is equal to form/this // If Form1 is closed, button1.Parent is null var parent = button1.Parent; } } Form2: public partial class Form2 : Form { public Form2 () { InitializeComponent(); } public delegate void FormActionHandler ( object o ); public event FormActionHandler FormAction = delegate { }; private void button1_Click ( object sender , EventArgs e ) { FormAction( "Button clicked." ); } } Ideally, I would like to avoid raising events to closed/disposed forms (which I'm not sure is possible) or find a clean way of handling this in the caller (in this case, Form1). Any help is appreciated.

    Read the article

  • c# Display the data in the List view

    - by Kumu
    private void displayResultsButton_Click(object sender, EventArgs e) { gameResultsListView.Items.Clear(); //foreach (Game game in footballLeagueDatabase.games) //{ ListViewItem row = new ListViewItem(); row.SubItems.Add(game.HomeTeam.ToString()); row.SubItems.Add(game.HomeScore.ToString()); row.SubItems.Add(game.AwayTeam.ToString()); row.SubItems.Add(game.AwayScore.ToString()); gameResultsListView.Items.Add(row); // } //footballLeagueDatabase.games.Sort(); } } } This is the display button and the following code describes the add button. private void addGameButton_Click(object sender, EventArgs e) { if ((homeTeamTxt.Text.Length) == 0) MessageBox.Show("You must enter a Home Team"); else if (homeScoreUpDown.Maximum <= 9 && homeScoreUpDown.Minimum >= 0) MessageBox.Show("You must enter one digit between 0 and 9"); else if ((awayTeamTxt.Text.Length) == 0) MessageBox.Show("You must enter a Away Team"); else if (awayScoreUpDown.Maximum <= 9 && awayScoreUpDown.Minimum >= 0) MessageBox.Show("You must enter one digit between 0 to 9"); else { //checkGameInputFields(); game = new Game(homeTeamTxt.Text, int.Parse(homeScoreUpDown.Value.ToString()), awayTeamTxt.Text, int.Parse(awayScoreUpDown.Value.ToString())); MessageBox.Show("Home Team" + 't' + homeTeamTxt.Text + "Away Team" + awayTeamTxt.Text + "created"); footballLeagueDatabase.AddGame(game); //clearCreateStudentInputFields(); } } I need to insert data into the above text field and Numeric up down control and display them in the list view. But I dont know How to do it, because when I press the button "Display Results" it displays the error message. If you know how can I display the data in the list view, please let me know.This is the first time I am using List view.

    Read the article

  • BackgroundWorker acting bizarrely...

    - by vdh_ant
    Hi guys I'm working on some code that calls a service. This service call could fail and if it does I want the system to try again until it works or too much time has passed. I am wondering where I am going wrong as the following code doesn't seem to be working correctly... It randomly only does one to four loops... protected virtual void ProcessAsync(object data, int count) { var worker = new BackgroundWorker(); worker.DoWork += (sender, e) => { throw new InvalidOperationException("oh shiznit!"); }; worker.RunWorkerCompleted += (sender, e) => { //If an error occurs we need to tell the data about it if (e.Error != null) { count++; System.Threading.Thread.Sleep(count * 5000); if (count <= 10) { if (count % 5 == 0) this.Logger.Fatal("LOAD ERROR - The system can't load any data", e.Error); else this.Logger.Error("LOAD ERROR - The system can't load any data", e.Error); this.ProcessAsync(data, count); } } }; worker.RunWorkerAsync(); } Cheers Anthony

    Read the article

  • How to defer execution of an Event on each item in a collection until iteration of collection is com

    - by Metro Smurf
    Of Note: This is more of a curiosity question than anything else. Given a List<Window> where each window has an event attached to the Close Event which removes the window from the collection, how could you use delegates / events to defer the execution of the Close Event until the collection has been iterated? For example: public class Foo { private List<Window> OpenedWindows { get; set; } public Foo() { OpenedWindows = new List<Window>(); } public void AddWindow( Window win ) { win.Closed += OnWindowClosed; OpenedWindows.Add( win ); } void OnWindowClosed( object sender, EventArgs e ) { var win = sender as Window; if( win != null ) { OpenedWindows.Remove( win ); } } void CloseAllWindows() { // obviously will not work because we can't // remove items as we iterate the collection // (the close event removes the window from the collection) OpenedWindows.ForEach( x => x.Close() ); // works fine, but would like to know how to do // this with delegates / events. while( OpenedWindows.Any() ) { OpenedWindows[0].Close(); } } } Specifically, within the CloseAllWindows() method, how could you iterate the collection to call the close event, but defer the event being raised until the collection has been completely iterated?

    Read the article

  • Concurrent connections in C# socket

    - by Chu Mai
    There are three apps run at the same time, 2 clients and 1 server. The whole system should function as following: The client sends an serialized object to server then server receives that object as a stream, finally the another client get that stream from server and deserialize it. This is the sender: TcpClient tcpClient = new TcpClient(); tcpClient.Connect("127.0.0.1", 8888); Stream stream = tcpClient.GetStream(); BinaryFormatter binaryFormatter = new BinaryFormatter(); binaryFormatter.Serialize(stream, event); // Event is the sending object tcpClient.Close(); Server code: TcpListener listener = new TcpListener(IPAddress.Parse("127.0.0.1"), 8888); listener.Start(); Console.WriteLine("Server is running at localhost port 8888 "); while (true) { Socket socket = listener.AcceptSocket(); try { Stream stream = new NetworkStream(socket); // Typically there should be something to write the stream // But I don't knwo exactly what should the stream write } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); Console.WriteLine("Disconnected: {0}", socket.RemoteEndPoint); } } The receiver: TcpClient client = new TcpClient(); // Connect the client to the localhost with port 8888 client.Connect("127.0.0.1", 8888); Stream stream = client.GetStream(); Console.WriteLine(stream); when I run only the sender and server, and check the server, server receives correctly the data. The problem is when I run the receiver, everything is just disconnected. So where is my problem ? Could anyone point me out ? Thanks

    Read the article

  • How to determine if the camera button is half pressed

    - by Matthew
    I am creating a small test camera application, and I would like to be able to implement a feature that allows focus text bars to be present on the screen while the hardware camera button is pressed half way down. I created a camera_ButtonHalfPress event to perform the focus action, but I am unsure of how to toggle the text bars I would like to show on the screen accordingly. Essentially, my goal would be to show the text bars while the camera button is pressed half way down, and then remove them if the button is pressed all the way or the button is released before being pressed all the way down. The button being released is the part I am having trouble with. What I have is as follows: MainPage.xaml.cs private void camera_ButtonHalfPress(object sender, EventArgs e) { //camera.Focus(); // Show the focus brackets. focusBrackets.Visibility = Visibility.Visible; } } private void camera_ButtonFullPress(object sender, EventArgs e) { // Hide the focus brackets. focusBrackets.Visibility = Visibility.Collapsed; camera.CaptureImage(); } } Currently, if the the user decides to release the camera button before it is pressed all the way, the focus brackets persist on the screen. How might I fix this issue?

    Read the article

  • Code producing System.NullReferenceException error for Membership.GetUser(). This is VB.Net (ASP.Net 4)

    - by Derrek
    I have a Default.aspx page that is not static. I have added functionality with datalist and sqldatasources. When a user logins he/she will see items like saved workouts, saved equipment, total replys, etc... This is based on getting the currently logged in user UserID. Quite simply this works great when the user is logged in. However, I do not want to force a user to login to view the Default page because it does have functionality on it that does not require login. When a user is not logged in of course I receive the [System.NullReferenceException] error. I understand the error well but I do not know how to code to fix it. That is where I need help. I will admit I am more designer than developer. However, I do know the exception error I am receivving is caused by me not setting a value in my code when a user is not logged in. I do not know how to do that and have for a week made unsuccessful attempts at writing the code. Both sets of code below compile for VB.Net/ASP.Net 4/Visual Studio 2010 without errors. However, I still get the System.NullReferenceException error if not logged in. I know it can be done but I do not know the right syntax. If you can help please insert you code in mine or write it out. JUST TELLING ME WHERE TO GO TO FIND AN ANSWER WON'T HELP. I HAVE DONE THAT FOR 7 STRAIGHT DAYS. I APPRECIATE OUR HELP. Partial Class _Default Inherits System.Web.UI.Page Protected Sub SqlDataSource4_Selecting(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs) Handles SqlDataSource4.Selecting Dim MemUser As MembershipUser MemUser = Membership.GetUser() If Not MemUser Is DBNull.Value Then UserID.Text = MemUser.ProviderUserKey.ToString() e.Command.Parameters("@UserId").Value = MemUser.ProviderUserKey.ToString() End If End Sub -------------------------------------ORIGINAL CODE------------------------------- Partial Class _Default Inherits System.Web.UI.Page Protected Sub SqlDataSource4_Selecting(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs) Handles SqlDataSource4.Selecting Dim MemUser As MembershipUser MemUser = Membership.GetUser() UserID.Text = MemUser.ProviderUserKey.ToString() e.Command.Parameters("@UserId").Value = MemUser.ProviderUserKey.ToString() End Sub

    Read the article

  • How can I create an instance of a class that I can use is more than one place in c#

    - by user1743574
    So I've been working on a class that details students of a university. I have one button that sets the details to a new instance of a class, and another to check if the student passed, through a method in my Class. The problem is that I create an instance of a class in the first button to add the values from what the user input, but I cannot use the second button to access the instance of the class created in the first button. private void button3_Click(object sender, EventArgs e) { Student student1 = new Student(); label1.Text = student1.text(); if (student1.hasPassed() == true) { passfailtextbox.Text = "Pass"; } else { passfailtextbox.Text = "Fail"; } } private void button1_Click(object sender, EventArgs e) { Student student1 = new Student(); student1.FirstName = firstnamebox.Text; student1.SecondName = secondnamebox.Text; student1.DateofBirth = DateTime.Parse(dobtextbox.Text).Date; student1.Course = coursetextbox.Text; student1.MatriculationNumber = int.Parse(matriculationtextbox.Text); student1.YearMark = double.Parse(yearmarktextbox.Text); } public Boolean hasPassed() { if (YearMark < 40) { return false; } else { return true; } } public string text() { return "Student" + " " + firstname + " " + secondname + " " + course + " " + dob.ToString() + " " + matriculationnumber.ToString() + " " + yearmark.ToString() ; }

    Read the article

  • Cancelling BackgroundWorker While Running

    - by Nevets
    I have an application in which I launch a window that displays byte data coming in from a 3rd party tool. I have included .CancelAsync() and .CancellationPending into my code (see below) but I have another issue that I am running into. private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { Thread popupwindow = new Thread(() => test()); popupwindow.Start(); // start test script if(backgroundWorker.CancellationPending == true) { e.Cancel = true; } } private voide window_FormClosing(object sender, FormClosingEventArgs e) { try { this.backgroundWorker.CancelAsync(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } Upon cancelling the test I get an `InvalidOperationException occurred" error from my rich text box in my pop-up window. It states that "Invoke or BeginInvoke" cannot be called on a control until the window handle has been created". I am not entirely sure what that means and would appreciate your help. LogWindow code for Rich Text Box: public void LogWindowText(LogMsgType msgtype, string msgIn) { rtbSerialNumberValue.Invoke(new EventHandler(delegate { rtbWindow.SelectedText = string.Empty; rtbWindow.SelectionFont = new Font(rtbWindow.SelectionFont, FontStyle.Bold); rtbWindow.SelectionColor = LogMsgTypeColor[(int)msgtype]; rtbWindow.AppendText(msgIn); rtbWindow.ScrollToCaret(); })); }

    Read the article

  • onKeypress Enter Key event on textfield not working in Chrome

    - by rlcrews
    I have a question along the same vein as the one asked here regarding how the enter key is handled in chrome. The effect I am trying to accomplish is to allow the enter key to call a click event of one a button while focus in within the current field. To accomplish this I am using the following code: javascript: <script type="text/javascript"> //attempting to capture keypress for chrome here but this is not working $("#txtContainer").keypress(function (e) { if (e.keyCode == '13') { e.preventDefault(); doClick(buttonname, e); return false; } }); function doClick(buttonName, e) { var key; if (window.event) key = window.event.keyCode; //IE else key = e.which; //firefox if (key == 13) { var btn = document.getElementById(buttonName); if (btn != null) { btn.click(); event.keyCode = 0 } } } </script> within the aspx <form id="form1" runat="server"> <div> <asp:LinkButton ID="newBtn" runat="server" OnClick="btnLogin_Click" Text="ASP Link" /> <asp:TextBox ID="txtContainer" runat="server" Width="100" /> <asp:Label ID="time_lbl" runat="server" /> </div> </form> and within the code behind aspx.cs protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { txtContainer.Attributes.Add("onKeyPress", "doClick('" + newBtn.ClientID + "',event)"); } } public void btnLogin_Click(object sender, EventArgs e) { time_lbl.Text = txtContainer.Text; } The above code works fine in FF and IE however chrome continues to submit the entire form vs. capturing the keypress on the enterkey. Thank you for any suggestions.

    Read the article

  • Can't use method from class in other file

    - by user1833848
    I am not able to use one of my methods that i implemented in my tableviewcell file in my tableview controller implementation. I tried searching the web and xcode help with no luck. My codes looks like this: TableViewController.h: #import TableViewCell.h @interface TableViewController : UITableViewController @property (nonatomic, strong) IBOutlet UIBarButtonItem *A1Buy; @property (nonatomic, getter = isUserInteractionEnabled) BOOL userInteractionEnabled; - (IBAction)A1Buy:(UIBarButtonItem *)sender; TableViewController.m: @implementation A1ViewController @synthesize A1Buy = _A1Buy; @synthesize userInteractionEnabled; - (IBAction)A1Buy:(UIBarButtonItem *)sender { [TableViewCell Enable]; //this is where it gives an error } TableViewCell.h: @interface TableViewCell : UITableViewCell { BOOL Enable; BOOL Disable; } @property (nonatomic, getter = isUserInteractionEnabled) BOOL userInteractionEnabled; TableViewCell.m: @implementation TableViewCell; @synthesize userInteractionEnabled; - (BOOL) Enable { return userInteractionEnabled = YES; } - (BOOL) Disable { return userInteractionEnabled = NO; } As you can see i am trying to enable user interaction with a button, but Xcode only gives me errors like "class does not have this method" and stuff like that. All files are importet correctly so thats not why. Would appreciate any help. Thanks!

    Read the article

  • Serialport List Read problem and NullReferenceException?

    - by Plumbum7
    Hello everybody, Using Microsoft VC# 2008 Express (little fact about me : non experience in c#, programskills further very beginnerlevel. This peace op program is to communicate with Zigbee switching walloutlets (switching, status info). and is downloaded from http://plugwiselib.codeplex.com/SourceControl/list/changesets The problem: NullRefferenceException was UnHandled private void port_DataReceived(object sender, SerialDataReceivedEventArgs e) {// Event for receiving data string txt = port.ReadExisting(); Console.WriteLine(txt); List<PlugwiseMessage> msg = reader.Read (Regex.Split (txt, "\r\n" )); //Console.WriteLine( msg ); DataReceived(sender, new System.EventArgs(), msg); VC# Marks the last line and says msg is empty. so i looked further. Msg come's from txt text is filled with "000002D200C133E1\r\nPutFifoUnicast 40 : Handle 722 :"< so it goes wrong in or reader.Read or in the List so i looked further: public List<PlugwiseMessage> Read(string[] serialData) { Console.WriteLine(serialData); List<PlugwiseMessage> output = new List<PlugwiseMessage>(); Console.WriteLine(output); Both (serialData) as (output); are empty. So can i assume that the problem is in: Read(string[] serialData) But now the questions, Is Read(string[] serialData) something which is a Windows.Refence or is is from a Method ? and IF this is so is this then reader.READ (how can i find this)? (answered my own question proberly)(method reader)(private PlugwiseReader reader) So why isn't is working trough the serialData ? or is it the List<PlugwiseMessage> part, but i have no idea how it is filled can sombody help me ?

    Read the article

  • Warning ,i can not solving in PHP code

    - by user318068
    hi , in code there Warning Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in C:\xampp\htdocs\Join.php on line 69 but i can not solving where exactly can you help me where the error in this code . <?php 51. include("connect.php"); 53. $email = mysql_query("select MemberEmail from members where MemberID= '$id' "); 54. while ($row = mysql_fetch_array($email)) 55. { 57. $memEmail=$row['MemberEmail']; } 62. $sql = mysql_query("select * from ninvite where recieverMemberEmail ='$memEmail' and viwed= '0' order by RoomID desc"); 64. $num =mysql_num_rows($sql); 67. if ($sql and $num >0 ) { 69. while($row=mysql_fetch_array($sql)) { 71. $sender=$row['SenderMemberID']; 73. $room=$row['RoomID']; 77. $sql2 =mysql_query("select MemberName from members where MemberID ='$sender' "); 78. $sql1 =mysql_query("select RoomName,RoomLogo from rooms where RoomID ='$room' "); 79. while($row=mysql_fetch_array($sql2)) { $mem =$row['MemberName']; } 84. while($rows=mysql_fetch_array($sql1)) { $Ro =$rows['RoomName']; $logo = $rows['RoomLogo']; } 89. ?> Thanks alot

    Read the article

  • Making a Delete and Reply button in Jquery

    - by Branko Ostojic
    this is my second post on the website. Of all other sites i tried, this one gave the most accurate and useful information! I'm in a bit of a trouble with buttons, i have a task to make an inbox and to add a "reply" and "delete" button into every instance of the message. I was indeed wandering if there is a better way to do that than forcing the HTML code into the script, because every message is dynamically generated. Any help and/or suggestions would be very appreciated!(The objects are called from a JSON file). $(document).ready(function(){ $.getJSON('public/js/data.json', function(json){ $.each(json.data, function(i, data){ var output = ''; if(data.from.id != '234' && data.from.name != 'Alan Ford'){ $("#inbox").append( output += '<div class="post">'+ '<div class="h1">'+data.from.name+' - '+data.subject+'</div>'+ //this gives the name of the person who sent the message and the subject '<div class="content">'+data.message_formatted+'</div>'+ //The content of the message //buttons should be squeezed left of the date //this gives the date of the message sent '<div class="time">'+data.date_sent_formatted.formatted+'</div>'+ '</div>' ); }}); }); }); var date_sent=convertToDateTime(); function delete_message(id){ console.log('Delete message with id: '+id); } function reply_message(id, sender){ console.log('Message id: '+id); console.log('Reply to: '+sender); } The complete code in the JSFiddle . Just copy/pasted!

    Read the article

  • Custom class deallocated as soon as the app starts.

    - by Tangrs
    Heya, I've added a class object to the nib file. All connections are made. But for some reason, the object is deallocated as soon as it's created. Here's the code: control.h: #import <Foundation/Foundation.h> @interface control : NSObject { IBOutlet UILabel *PlayerScore; } -(IBAction) addPoint: sender; -(void) dealloc; @end control.m: #import "control.h" @implementation control -(IBAction)addPoint: sender { NSLog(@"Ohhai. Didn't crash."); //Doesn't even make it to this stage. int i = [PlayerScore.text intValue]; PlayerScore.text=[NSString stringWithFormat: @"%d",++i]; } -(void) dealloc { NSLog(@"ZOMGWTF?"); [super dealloc]; } @end Here is the console log: [Session started at 2010-06-09 19:47:57 +1000.] 2010-06-09 19:47:58.771 App[91100:207] ZOMGWTF? And after I click the button which messages addPoint, of course, it crashes. 2010-06-09 19:47:59.703 App[91100:207] * -[control] performSelector:withObject:withObject:]: message sent to deallocated instance 0x3843d80 Does anyone have any ideas?

    Read the article

  • how do i make the app take correct input..?

    - by user1824343
    This is my windows app's one layout which converts Celsius to Fahrenheit. The problem is that when I try to input the temperature it shows some junk(for eg: if i enter '3' it displayin '3.0000009') and sometimes its even showing stack overflow exception. The output is also not shown properly : cel.text is the textbox for celsius. fahre.text is the textbox for fahrenheit. namespace PanoramaApp1 { public partial class FahretoCel : PhoneApplicationPage { public FahretoCel() { InitializeComponent(); } private void fahre_TextChanged(object sender, TextChangedEventArgs e) { if (fahre.Text != "") { try { double F = Convert.ToDouble(fahre.Text); cel.Text = "" + ((5.0/9.0) * (F - 32)) ; //this is conversion expression } catch (FormatException) { fahre.Text = ""; cel.Text = ""; } } else { cel.Text = ""; } } private void cel_TextChanged(object sender, TextChangedEventArgs e) { if (cel.Text != "") { try { Double c = Convert.ToDouble(cel.Text); fahre.Text = "" + ((c *(9.0 / 5.0 )) + 32); } catch (FormatException) { fahre.Text = ""; cel.Text = ""; } } else { fahre.Text = ""; } } } }

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >