Search Results

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

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

  • databinding to self without code

    - by jcollum
    I'm building a UserControl in WPF. The control has two properties, Title and Description, that I'd like to bind to two textblocks. Seems real straightforward, and I got it working, but I'm curious about something. To get it to work I had to add this code: void CommandBlock_Loaded(object sender, RoutedEventArgs e) { this.DataContext = this; } My bindings look like this: <TextBlock Text="{Binding Title}" Width="100" ... /> <TextBlock Text="{Binding Description}" Width="100" ... /> What I'm wondering is how come I couldn't get it to work without the this.DataContext = this; and instead use DataContext="{Binding RelativeSource={RelativeSource Self}}" (in the UserControl element of the markup)? I'm sure I'm missing something about DataContexts but don't know what.

    Read the article

  • Don't show Data in DataGrid

    - by mSafdel
    Hi in my app, I used WCF Services for load data from SQL DB then in Completed Event Handler of my ServiceClient write this code: void svc_GetOrdersCompleted(object sender, GetOrdersCompletedEventArgs e) { if (e.Error == null) { dgOrders.ItemsSource = e.Result; txtStatus.Text = ""; } else txtStatus.Text = "Error occured while loading orders from database"; } dgOrders is my DataGrid and And AutoGenerateColumns set to True. in line 5: eResult have a number of Order objects but after this code DataGrid can't show data. Why? this ia my xaml for dgOrders: <data:DataGrid x:Name="dgOrders" Grid.Row="0" Grid.Column="1" AutoGenerateColumns="True" SelectionChanged="dgOrders_SelectionChanged" Foreground="Green"> </data:DataGrid> this is my Source code please guide me.

    Read the article

  • ASP.NET GridView - how to enable validation declaratively

    - by Joe
    It it possible to enable validation in an ASP.NET GridView purely declaratively? What I've tried: A GridView bound to an ObjectDataSource with SelectMethod and UpdateMethod defined The GridView contains some ReadOnly BoundField columns and a TemplateField whose EditTemplate contains a TextBox and a RegularExpressionValidator that only allows numeric input in the TextBox. The GridView also contains a CommandField with ShowEditButton=true and CausesValidation=true. If I click on Edit, enter an invalid value, then click on Save, there is a PostBack, and an exception is thrown in the server (Input string was not in a correct format). I can of course avoid this by adding validation code to the RowUpdating event handler on the server (see below), but is there any declarative way to force the validation to be done without adding this code? protected void MyGridView_RowUpdating(object sender, GridViewUpdateEventArgs e) { Page.Validate("MyValidationGroup"); if (!Page.IsValid) { e.Cancel = true; } }

    Read the article

  • problem in displays data in one page

    - by user318068
    hi ,,,,, I have a problem in the following code ... The following code works as follows displays the invites for each member so that if he had five invite from supposed to be displayed all on one page But before you code that does not function Proper image is the only display one invite on the page and until the approval or rejection of the invitation displays the invite the other .... But this is not my want to offer all on one page I wish I could solve the problem and I can view all calls in one page I think that the problem is in the order code I think that the problem is in the order code my code : <?php session_start(); if (!isset($_SESSION['user_id'])) { header("Location: login.php"); } $id=$_SESSION['user_id']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <center> <?php include("connect.php"); $sql =mysql_query("select * from ninvite where recieverMemberID ='$id' and viwed= '0'"); $num =mysql_num_rows($sql); echo $num ; if ($num>0) { while($row=mysql_fetch_array($sql)) { $sender=$row['SenderMemberID']; $room=$row['RoomID']; $sql =mysql_query("select MemberName from members where MemberID ='$sender' "); $sql1 =mysql_query("select RoomName from rooms where RoomID ='$room' "); while($row=mysql_fetch_array($sql)) {$mem =$row['MemberName']; } while($rows=mysql_fetch_array($sql1)) { $Ro =$rows['RoomName']; ?> <form action="join.php" method="post"> <label> </label> <br/> <label> <?php echo " you have invite from $mem to join $Ro"; ?> </label> <br/><br/> <label>accept</label> <input name="radio1" type="radio" value="accpet" /> <label>reject</label> <input name="radio1" type="radio" value="Reject" /><br/> <input type="submit" name="submit" value="done" /> </form> <?php } } } ?> </center> </body> </html> thanks alot. my SQl -- phpMyAdmin SQL Dump -- version 3.2.4 -- http://www.phpmyadmin.net -- Host: localhost -- Generation Time: May 07, 2010 at 12:50 ? -- Server version: 5.1.41 -- PHP Version: 5.3.1 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT /; /!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS /; /!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION /; /!40101 SET NAMES utf8 */; -- -- Database: tr -- -- Table structure for table joinroom CREATE TABLE IF NOT EXISTS joinroom ( MemberID int(10) NOT NULL, RoomID int(10) NOT NULL, PRIMARY KEY (MemberID,RoomID) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table joinroom INSERT INTO joinroom (MemberID, RoomID) VALUES (28, 1); -- -- Table structure for table members CREATE TABLE IF NOT EXISTS members ( MemberID int(10) unsigned NOT NULL AUTO_INCREMENT, MemberName varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, MemberPass varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, MemberEmail varchar(30) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, MemberLocation text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, MemberImg text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (MemberID) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=34 ; -- -- Dumping data for table members INSERT INTO members (MemberID, MemberName, MemberPass, MemberEmail, MemberLocation, MemberImg) VALUES (28, 'marwa', '1234', '[email protected]', 'mmmmmm', 'dddddddddd'), (29, 'nora', '1234', '[email protected]', 'fffffffffffgg', 'gggggggggggggg'), (30, 'soso', '1234', '[email protected]', 'ffffffff', 'kkkkkkkkkkkkkkkkkk'), (31, 'gege', '1234', '[email protected]', 'kkkkkkkkkkkkkkkk', 'uuuuuuuuuuuuuuuuu'), (32, 'nono', '1234', '[email protected]', 'ggggggggggggaaaaa', 'aaaaaaaaaaaaaaa'), (33, 'nda', '1234', '[email protected]', 'kkkkkkkkkkkkkkkk', 'ooooooooooooooo'); -- -- Table structure for table ninvite CREATE TABLE IF NOT EXISTS ninvite ( SenderMemberID int(11) NOT NULL AUTO_INCREMENT, recieverMemberID varchar(30) NOT NULL, RoomID int(11) NOT NULL, viwed int(11) NOT NULL, PRIMARY KEY (SenderMemberID,recieverMemberID,RoomID) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=33 ; -- -- Dumping data for table ninvite INSERT INTO ninvite (SenderMemberID, recieverMemberID, RoomID, viwed) VALUES (28, '33', 1, 0), (28, '32', 1, 0), (28, '31', 1, 0); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT /; /!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS /; /!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

    Read the article

  • Request for another page from aspx site

    - by sanjuro
    Hi, it is possible to do a request for another page on internet from page_load? I mean if it is possible to aquire markup code with informations from another page and display them on my aspx site? For example something like this: protected void Page_Load(object sender, EventArgs e) { UnknownType anotherSite = GetMarkupCode("www.fifa.com"); //parse anotherSite . . . //display parsed informations . . . } If it is possible how can i do that? Many thanks for answers.

    Read the article

  • Explain to me the following VS 2010 Extension Sample code..

    - by ealshabaan
    Coders, I am building a VS 2010 extension and I am experimenting around some of the samples that came with the VS 2010 SDK. One of the sample projects is called TextAdornment. In that project there is a weirdo class that looks like the following: [Export(typeof(IWpfTextViewCreationListener))] [ContentType("text")] [TextViewRole(PredefinedTextViewRoles.Document)] internal sealed class TextAdornment1Factory : IWpfTextViewCreationListener While I was experimenting with this project, I tried to debug the project to see the flow of the program and I noticed that this class gets hit when I first start the debugging. Now my question is the following: what makes this class being the first class to get called when VS starts? In other words, why this class gets active and it runs as of some code instantiate an object of this class type? Here is the only two files in the sample project: TextAdornment1Factory.cs using System.ComponentModel.Composition; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Utilities; namespace TextAdornment1 { #region Adornment Factory /// /// Establishes an to place the adornment on and exports the /// that instantiates the adornment on the event of a 's creation /// [Export(typeof(IWpfTextViewCreationListener))] [ContentType("text")] [TextViewRole(PredefinedTextViewRoles.Document)] internal sealed class TextAdornment1Factory : IWpfTextViewCreationListener { /// /// Defines the adornment layer for the adornment. This layer is ordered /// after the selection layer in the Z-order /// [Export(typeof(AdornmentLayerDefinition))] [Name("TextAdornment1")] [Order(After = PredefinedAdornmentLayers.Selection, Before = PredefinedAdornmentLayers.Text)] [TextViewRole(PredefinedTextViewRoles.Document)] public AdornmentLayerDefinition editorAdornmentLayer = null; /// <summary> /// Instantiates a TextAdornment1 manager when a textView is created. /// </summary> /// <param name="textView">The <see cref="IWpfTextView"/> upon which the adornment should be placed</param> public void TextViewCreated(IWpfTextView textView) { new TextAdornment1(textView); } } #endregion //Adornment Factory } TextAdornment1.cs using System.Windows; using System.Windows.Controls; using System.Windows.Media; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Formatting; namespace TextAdornment1 { /// ///TextAdornment1 places red boxes behind all the "A"s in the editor window /// public class TextAdornment1 { IAdornmentLayer _layer; IWpfTextView _view; Brush _brush; Pen _pen; ITextView textView; public TextAdornment1(IWpfTextView view) { _view = view; _layer = view.GetAdornmentLayer("TextAdornment1"); textView = view; //Listen to any event that changes the layout (text changes, scrolling, etc) _view.LayoutChanged += OnLayoutChanged; _view.Closed += new System.EventHandler(_view_Closed); //selectedText(); //Create the pen and brush to color the box behind the a's Brush brush = new SolidColorBrush(Color.FromArgb(0x20, 0x00, 0x00, 0xff)); brush.Freeze(); Brush penBrush = new SolidColorBrush(Colors.Red); penBrush.Freeze(); Pen pen = new Pen(penBrush, 0.5); pen.Freeze(); _brush = brush; _pen = pen; } void _view_Closed(object sender, System.EventArgs e) { MessageBox.Show(textView.Selection.IsEmpty.ToString()); } /// <summary> /// On layout change add the adornment to any reformatted lines /// </summary> private void OnLayoutChanged(object sender, TextViewLayoutChangedEventArgs e) { foreach (ITextViewLine line in e.NewOrReformattedLines) { this.CreateVisuals(line); } } private void selectedText() { } /// <summary> /// Within the given line add the scarlet box behind the a /// </summary> private void CreateVisuals(ITextViewLine line) { //grab a reference to the lines in the current TextView IWpfTextViewLineCollection textViewLines = _view.TextViewLines; int start = line.Start; int end = line.End; //Loop through each character, and place a box around any a for (int i = start; (i < end); ++i) { if (_view.TextSnapshot[i] == 'a') { SnapshotSpan span = new SnapshotSpan(_view.TextSnapshot, Span.FromBounds(i, i + 1)); Geometry g = textViewLines.GetMarkerGeometry(span); if (g != null) { GeometryDrawing drawing = new GeometryDrawing(_brush, _pen, g); drawing.Freeze(); DrawingImage drawingImage = new DrawingImage(drawing); drawingImage.Freeze(); Image image = new Image(); image.Source = drawingImage; //Align the image with the top of the bounds of the text geometry Canvas.SetLeft(image, g.Bounds.Left); Canvas.SetTop(image, g.Bounds.Top); _layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, null); } } } } } }

    Read the article

  • Whatz wrong with this MSSQl Query ?

    - by ClixNCash
    Whatz wrong this MSSQl Query : Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SQLData As New System.Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True") Dim cmdSelect As New System.Data.SqlClient.SqlCommand("SELECT COUNT(*) FROM Table1 WHERE Name ='" + TextBox1.Text + "'", SQLData) SQLData.Open() If cmdSelect.ExecuteScalar > 0 Then Label1.Text = "You have already voted this service" Return End If Dim con As New SqlConnection Dim cmd As New SqlCommand con.Open() cmd.Connection = con cmd.CommandText = "INSERT INTO Tabel1 (Name) VALUES('" & Trim(Label1.Text) & "')" cmd.ExecuteNonQuery() Label1.Text = "Thank You !" SQLData.Close() End Sub

    Read the article

  • How to find which annotation send showDetails?

    - by Voloda2
    How to find which annotation send showDetails? MKPinAnnotationView* customPinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:BridgeAnnotationIdentifier] autorelease]; customPinView.pinColor = MKPinAnnotationColorPurple; customPinView.animatesDrop = YES; customPinView.canShowCallout = YES; // add a detail disclosure button to the callout which will open a new view controller page // // note: you can assign a specific call out accessory view, or as MKMapViewDelegate you can implement: // - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control; // UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; customPinView.rightCalloutAccessoryView = rightButton; return customPinView; - (void)showDetails:(id)sender { some code }

    Read the article

  • Getting MAX_INT from NSDateComponents

    - by MattyW
    I'm trying to write my first iPhone app, and I'm using a date picker object for the user to enter their date of birth. Part of my app requires the year in int format. I've added the code as below. What's odd is that 'month' gets the right value. But day and year seem to be stuck at MAX_INT (2147483647). Can anyone tell me what I'm doing wrong? -(IBAction)dateOfBirthChanged:(id)sender { NSCalendar* calender = [NSCalendar currentCalendar]; NSDateComponents* dateComponents = [calender components:NSMonthCalendarUnit fromDate:[datepicker date]]; NSInteger day = [dateComponents day]; NSInteger month = [dateComponents month]; NSInteger year = [dateComponents year]; label.text = [NSString stringWithFormat:@"Your year of birth is %d", year]; }

    Read the article

  • How to show/hide UIImageView when I want.

    - by Madness64
    I'm having a little problem with an iPhone app I'm currently developing. When the user touch a button, it calls an IBAction named refreshQuestion, which is supposed to show an image hover the screen to ask the user to wait a moment, then it has to call another function, and finally it has to hide the image. The problem is that the image won't appear. As well as the network activity indicator. Any help? Here is the code : - (IBAction)refreshQuestion:(id)sender{ pleaseWait.hidden = NO; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; [self loadData]; pleaseWait.hidden = YES; [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; }

    Read the article

  • WPF C#: Starting crash due to client 'Region and Language' settings

    - by FrieK
    Hi, I'm working on a WPF C# application, and it seems to crash with a few random people. So eventually I found out it was the 'Region and Language' settings that was responsible. For example, if I were to set my Format to English (United States) it will work, if I set it to Swedish (Sweden) it will crash from the start. When I test this in Visual Studio 2010 it gives error 'TypeInitializationException'. More precisely it does it here (it doesn't get passed the InitializeComponent() void): private void RadioButton_Checked(object sender, RoutedEventArgs e) { Info.SortOrder = SortBy.Rank; } It claims the error at the first line, which is just setting an enum value to a variable. I guess it's just doing it there because it's the first thing it makes, or something. Anyone has any idea how to fix this? I've searched around but can't seem to find out how :( Any help is much appreciated! Thanks

    Read the article

  • Handle error at non-UI thread

    - by DreamTeam Mobile
    For some reason unhandled exception which occur at non-UI thread don't handled by App_UnhandledException handler. This approach works well for Windows Phone apps to globally handle, track and analyze exceptions but doesn't work for Windows 8 apps. this.UnhandledException += App_UnhandledException; //doesn't handle private void Button_Click_1(object sender, RoutedEventArgs e) { var task = new Task(() => { throw new NullReferenceException("Test exc in UI thread"); }); task.Start(); } Please, advise.

    Read the article

  • c# how to get keydown and button click to do the same thing??

    - by myax
    I am new to C#.I am learning to make a calculator just like ms windows calculator.the buttons work when i click it, but I want the numpad to work too. Suppose the user types '0', it should be the same as if he clicked the 0 button on my gui. here is my button click event for 0. private void button0_Click(object sender, EventArgs e) { checkifequa(); textBox1.Text = textBox1.Text + "0"; } how do i get the keydown to work?

    Read the article

  • SQL Stored Procedure fired from C# Code-Behind not working on UPDATE

    - by CSSHell
    I have a stored procedure called from a C# code-behind. The code fires but the update command does not get performed. The stored procedure, if run directly, works. I think I am having a brain fart. Please help. :) CODEBEHIND protected void btnAbout_Click(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(strConnection); SqlCommand myCommand = new SqlCommand("spUpdateCMSAbout", myConnection); myConnection.Open(); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add("@AboutText", SqlDbType.NVarChar, -1).Value = txtAbout.Text.ToString(); myCommand.ExecuteNonQuery(); myConnection.Close(); } STORED PROCEDURE ALTER PROCEDURE fstage.spUpdateCMSAbout ( @AboutText nvarchar(max) ) AS BEGIN SET NOCOUNT ON; UPDATE fstage.staticCMS SET About = @AboutText; END HTML <asp:Button ID="btnAbout" runat="server" Text="Save" CausesValidation="False" onclick="btnAbout_Click" UseSubmitBehavior="False" /> C# .NET 4.0

    Read the article

  • Problem with DataGrid_CellFormatting event to set default value

    - by Royson
    Hi, I have created an applicationto display list of files. it also provide user interface for adding new column to a gridview. DataGridViewTextBoxColumn txtBoxColumn = new DataGridViewTextBoxColumn(); txtBoxColumn.Name = columnName; txtBoxColumn.HeaderText = columnName; g_dataGridView.Columns.Add(txtBoxColumn); User will create some custom type column therefore i am adding column directly to grid. I am also able to set its default value before adding for this i am using DataGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (colIndexWithDefaultValue.Count > 0) { if (colIndexWithDefaultValue.Contains(e.ColumnIndex)) { g_dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = colIndexWithDefaultValue[e.ColumnIndex]; } } } where colIndexWithDefaultValue is list of columns with its default value. It is able to show newly created column with default value. But values are getting set for currently visible rows. To set value for all rows i have to do scrolling. So, how do i overcome this problem...

    Read the article

  • How do I run modals windows from code with cocoa?

    - by Leandro
    Hi,everybody I`m trying to run a window as modal directly from the code. My program starts and a main NSWindows is showed.A thread still running to see if the user has a valid distribution. if he doesn't I need to run a modal.I mean, I have no buttons clicked in the interface.I've designed a NSWindow on the interface builder for a password set, and I want to call it only when my validation is not successful. I have tested and realized that these methods which are responsible for modal windows running only work in a IBAction environment. //This doesn't work -(void) showPasswordWindow { [NSApp runModalForWindow:[self window]]; } //this works But its not useful for me =( - (IBAction) passwordWindowButton:(id)sender { [NSApp runModalForWindow:[self window]]; } Please, help this newbie =)

    Read the article

  • show activity indicator while loading ViewController

    - by Crystal
    I have a ViewController that takes time to load its views. When I run Instruments, I see from the home screen, if I tap on the icon that pushes that view controller onto the stack, it's half laying out the views, and half getting the data for the views. I tried adding an activity indicator to display on the home screen over the button when the button is pressed to push the LongRunningViewController onto the stack. So I basically do this: - (IBAction)puzzleView:(id)sender { dispatch_async(dispatch_get_main_queue(), ^{ [self.activityIndicator startAnimating]; }); PuzzleViewController *detailViewController = [[[PuzzleViewController alloc] init] autorelease]; [self.navigationController pushViewController:detailViewController animated:YES]; [self.activityIndicator stopAnimating]; }

    Read the article

  • How can i call NStimer form one viewcontroller from unother viewcontroller?

    - by Bala
    At first time i call the timer like this in Third viewcontroller timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(targetMethod) userInfo:nil repeats:NO]; Then timer called the targetMethod -(void)targetMethod { First * sVC = [[First alloc] initWithNibName:@"First" bundle:[NSBundle mainBundle]]; [self presentModalViewController:sVC animated:YES]; [sVC release]; [timer invalidate]; } First viewcontroller opened.. In First viewcontroller had one button.In button action i wrote (IBAction) Action:(id)sender { [self dismissModalViewControllerAnimated:YES]; Third *BVC=[[Third alloc]init]; [Bvc TimerStart]; Timestart is function i start timer in this function.. i want to call Third viewcontroller timer function this place } timer started..But view didn't open (first )viewcontroller....... Please help me......

    Read the article

  • vb.net more performance for moving objects

    - by René
    I have the mission to make a small game for a school project. Pictures boxes, moved by a timer for walking enemies.If there are around 5 or 6 moving picture boxes at the form, my application get troubles and lags. After I kill some enemies (remove them from the Controls Collection of the Form/Panel) It come back smooth. I think the loop of the enemy movement is too complicated but I don't know how to make that simpler. Private Sub TimerEnemyMovement_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerEnemyMovement.Tick For Each Enemy As Control In PanelBackground.Controls If Enemy.Name.Substring(0, 5) = "Enemy" Then _enemy.MoveEnemy(Enemy, 2) End If Next End Sub I also thought about Multithreading but not sure this would solve the problem and there is also the problem that I can't access the Controls of my mainform. You see, I don't have much knowledge about vb.net Any ideas how to fix that lag?

    Read the article

  • Index out of range, but why?

    - by Stuart
    I have a gridview, and i have a SelectedIndexChanged event on it... protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow Row = GridView1.SelectedRow; //do some stuff } Then i get an error... Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index I dont understand why, the Gridview is being binded in pageload. but not in post back... if (!IsPostBack) { GridView1.DataSource = UserAccounts; GridView1.DataBind(); }

    Read the article

  • Save and Load Data on Today Extensions (iOS 8)

    - by Massimo Piazza
    Is it possible to save and load data on Today Extension using NSUserDefaults? After closing the Notification Center, the widget behaves like an app which is terminated, so any data results lost. How could I solve this issue? This is my code: NSUserDefaults *defaults; - (void)viewDidLoad { [super viewDidLoad]; defaults = [NSUserDefaults standardUserDefaults]; NSArray *loadStrings = [defaults stringArrayForKey:@"savedStrings"]; if ([loadStrings objectAtIndex:0] != nil) { [display setText:[NSString stringWithFormat:@"%@", [loadStrings objectAtIndex:0]]]; } if ([loadStrings objectAtIndex:1] != nil) { calculatorMemory = [NSString stringWithFormat:@"%@", [loadStrings objectAtIndex:1]].doubleValue; } } - (IBAction)saveData:(id)sender { NSString *displayString; NSString *memoryString; NSArray *saveStrings = [[NSArray alloc] initWithObjects: displayString, memoryString, nil]; defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject:saveStrings forKey:@"savedStrings"]; [defaults synchronize]; }

    Read the article

  • Make an animation 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

  • Updating label in another form (C#)

    - by cthulhu
    I want to update label of Form1 from Form2. So here's what I have: // Form1 public string Label1 { get { return this.label1.Text; } set { this.label1.Text = value; } } // Form2 private void button1_Click(object sender, EventArgs e) { Form1 frm1 = new Form1(); frm1.Label1 = this.textBox1.Text; this.Close(); } So the above code doesn't work. However, when I add the following: frm1.Show(); after this.Close(); in Form2 code, the Form1 is being opened again (two windows). But I want it to update in the same window so I suggest this.Close() is unnecessary.

    Read the article

  • How to measure the time taken by C# NetworkStream.Read?

    - by publicENEMY
    I want to measure time taken for client to receive data over tcp using c#. Im using NetworkStream.Read to read 100 megabits of data that are sent using NetworkStream.Write. I set the buffer to the same size of data, so there no buffer underrun problem etc. Generally it looks like this. Stopwatch sw = new Stopwatch(); sw.Start(); stream.Read(bytes, 0, bytes.Length); sw.Stop(); The problem is, there is a possibility where the sender hasnt actually sent the data but the stopwatch is already running. how can i accurately measure the time taken to receive the data? i did try to use the time lapse of the remote pc stream.Write, but the time it took to write is extremely small. by the way, is the stopwatch is the most accurate tool for this task?

    Read the article

  • update value of a variable outside a class in VB.NET

    - by dpp
    I have a class derived from a Form, it has textbox for username and password and an OK button. I want it to behave like an InputBox so I can use it like this: Dim Username As String = "" Dim Password As String = "" Dim authorization As New Authorization(Username, Password) authorization.ShowDialog() 'The user will click OK and I will expect the Username and Password to change based on the user input MsgBox(Username & " " & Password) The Authorization class: Public Class Authorization Dim RefUsername As String Dim RefPassword As String Public Sub New(ByRef Username As String, ByRef Password As String) InitializeComponent() RefUsername = Username 'I'm trying to pass reference instead of value RefPassword = Password 'I'm trying to pass reference instead of value End Sub Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorizeButton.Click RefUsername = Username.Text 'I'm trying to change value of variable outside the class RefPassword = Password.Text 'I'm trying to change value of variable outside the class Me.Close() End Sub End Class In short, I want to change the value of variables outside the class when the user clicks the OK, how am I going to accomplish that?

    Read the article

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