Search Results

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

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

  • Parsing question

    - by j-t-s
    Hi All I have tried using several different parsers as advised by somebody but i don't believe that they'd be of any use for this particular situation. I have a file that looks like this: mylanguagename(main) { OnLoad(protected) { Display(img, text, link); } Canvas(public) { Image img: "Images\my_image.png"; img.Name: "img"; img.Border: "None"; img.BackgroundColor: "Transparent"; img.Position: 10, 10; Text text: "This is a multiline str#ning. The #n creates a new line."; text.Name: text; text.Position: 10, 25; Link link: "Click here to enlarge img."; link.Name: "link"; link.Position: 10, 60; link.Event: link.Clicked; } link.Clicked(sender, link, protected) { Link link: from sender; Message.Display: "You clicked link."; } } ... and I need to be able to parse that code above, so and convert it to a Javascript equivelent, (or JScript). Can somebody please help, or get me started in the right direction? Thanks

    Read the article

  • Problem in Application_Error in Global.asax

    - by mmtemporary
    my problem is User.Identity.Name or Request.Url.AbsoluteUri in exception handling is empty when exception email to me. this is Application_Code: void Application_Error(object sender, EventArgs e) { Server.Transfer("~/errors/default.aspx"); } and this is default.aspx code: protected void Page_Load(object sender, EventArgs e) { if (Server.GetLastError() == null) return; Exception ex = Server.GetLastError().GetBaseException(); if (ex == null) return; string message = string.Format("User: ", User.Identity.Name); message += Environment.NewLine; message += string.Format("AbsoluteUri: ", Request.Url.AbsoluteUri); message += Environment.NewLine; message += string.Format("Form: ", Request.Form.ToString()); message += Environment.NewLine; message += string.Format("QueryString: ", Request.QueryString.ToString()); message += Environment.NewLine; HttpBrowserCapabilities browser = Request.Browser; string s = "Browser Capabilities:\n" + "Type = " + browser.Type + "\n" + "Name = " + browser.Browser + "\n" + "Version = " + browser.Version + "\n" + "Platform = " + browser.Platform + "\n" + "Is Crawler = " + browser.Crawler + "\n" + "Supports Cookies = " + browser.Cookies + "\n" + "Supports JavaScript = " + browser.EcmaScriptVersion.ToString() + "\n" + "\n"; message += s; message += Environment.NewLine; message += ex.ToString(); Exception lastException = (Exception)Application["LastException"]; if (lastException == null || lastException.Message != ex.Message) { Application.Lock(); Application["LastException"] = ex; Application.UnLock(); SiteHelper.SendEmail(SiteHelper.AdministratorEMail, "Error!!!", message, false); } Server.ClearError(); } but i receive email like this (this is header without full exception content): User: AbsoluteUri: Form: QueryString: Browser Capabilities: Type = IE8 Name = IE Version = 8.0 Platform = WinXP Is Crawler = False Supports Cookies = True Supports JavaScript = 1.2 why username and request url is emty? this problem is exist when i replace transfer with redirect or i don't use both. tanx

    Read the article

  • 2-Way databinding with Entity Framework and WPF DataGrid , is Possible ?

    - by Panindra
    i am working on POS application using SQL CE , WPF , Entity framework 3.5sp2 and iam trying to use data grid as my Order Entry Control for User to enter Products Order . Iam plannning to bind this to enitiy frmae work model , abd looking for 2 way updating ? private void button1_Click(object sender, RoutedEventArgs e) { using (MasterEntities nwEntities = new MasterEntities()) { var users = from d in nwEntities.Companies select new { d.CompanyId, d.CompanyName, d.Place }; listBox1.DataContext = users; dataGrid1.DataContext = users; // foreach (String c in customers) // { // MessageBox.Show(c.ToString()); // } } } When try to double clikc on the datagrid it through s a error with Caption " Invalid Operation Execption was unhandled " and Message " A TwoWay or OneWayToSource binding cannot work on the read-only property 'CompanyId' of type '<f__AnonymousType0`3[System.Int32,System.String,System.String]'. whats wrong here and my xaml coding goes like this <Grid> <ListBox Name="listBox1" ItemsSource="{Binding}" /> <Button Content="Show " Name="button1" Click="button1_Click" /> <DataGrid AutoGenerateColumns="False" Name="dataGrid1" ItemsSource="{Binding}" > <DataGrid.Columns> <DataGridTextColumn Header=" ID" Binding="{Binding CompanyId}"/> <DataGridTextColumn Header="Company Name" Binding="{Binding CompanyName}"/> <DataGridTextColumn Header="Place" Binding="{Binding Place}" /> </DataGrid.Columns> </DataGrid> </Grid> EDITED : i made the changes shown by @vorrtex, But, then i added another button to save the chages and in button click event i added follwing code , butit showing Updating error private void button2_Click(object sender, RoutedEventArgs e) { nwEntities.SaveChanges(); }

    Read the article

  • Bluetooth txt file byte increases????

    - by cheesebunz
    Hi everyone, i am able to xfer files from 1 mobile device to another. When the sender sends this text file of 8 bytes, the receiver end will become a 256bytes txt file and when i open the contents of the txt file, there are my infos plus alot of square boxes. Here is my code from the sender: string fileName = @"SendTest.txt"; System.Uri uri = new Uri("obex://" + selectedAddr + "/" + System.IO.Path.GetFileName(fileName)); ObexWebRequest request = new ObexWebRequest(uri); Stream requestStream = request.GetRequestStream(); FileStream fs = File.OpenRead(fileName); byte[] buffer = new byte[1024]; int readBytes = 1; while (readBytes != 0) { readBytes = fs.Read(buffer,0, buffer.Length); requestStream.Write(buffer,0, readBytes); } requestStream.Close(); ObexWebResponse response = (ObexWebResponse)request.GetResponse(); MessageBox.Show(response.StatusCode.ToString()); response.Close(); Any1 knws how do i solve it?

    Read the article

  • Custom Controls Properties - C# , Forms - :(

    - by user353600
    Hi I m adding custom control to my flowlayoutpanel , its a sort of forex data , refresh every second , so on each timer tick , i m adding a control , changing controls button text , then adding it to flowlayout panel , i m doing it at each 100ms timer tick , it takeing tooo much CPU , here is my custom Control . public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } private void UserControl1_Load(object sender, EventArgs e) { } public void displaydata(string name , string back3price , string back3 , string back2price , string back2 , string back1price , string back1 , string lay3price , string lay3 , string lay2price , string lay2 , string lay1price , string lay1 ) { lblrunnerName.Text = name.ToString(); btnback3.Text = back3.ToString() + "\n" + back3price.ToString(); btnback2.Text = back2.ToString() + "\n" + back2price.ToString(); btnback1.Text = back1.ToString() + "\n" + back1price.ToString(); btnlay1.Text = lay1.ToString() + "\n" + lay1price.ToString(); btnlay2.Text = lay2.ToString() + "\n" + lay2price.ToString(); btnlay3.Text = lay3.ToString() + "\n" + lay3price.ToString(); } and here is how i m adding control; private void timer1_Tick(object sender, EventArgs e) { localhost.marketData[] md; md = ser.getM1(); flowLayoutPanel1.Controls.Clear(); foreach (localhost.marketData item in md) { UserControl1 ur = new UserControl1(); ur.Name = item.runnerName + item.runnerID; ur.displaydata(item.runnerName, item.back3price, item.back3, item.back2price, item.back2, item.back1price, item.back1, item.lay3price, item.lay3, item.lay2price, item.lay2, item.lay1price, item.lay1); flowLayoutPanel1.SuspendLayout(); flowLayoutPanel1.Controls.Add(ur); flowLayoutPanel1.ResumeLayout(); } } now its happing on 10 times on each send , taking 60% of my Core2Duo cpu . is there any other way , i can just add contols first time , and then change the text of cutom controls buttons on runtime on each refresh or timer tick i m using c# .Net

    Read the article

  • i want to convert my aspx.cs to dll

    - by jay rathod
    i have a default.aspx page: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="btn" runat="server" Text="clicke here" OnClick="btn_Click"/> <asp:TextBox ID="txt" runat="server"></asp:TextBox> <asp:Label runat="server" ID="lbl"></asp:Label> </div> </div> </form> </body> </html> and default.aspx.cs : public partial class _Default : System.Web.UI.Page { string test; protected void Page_Load(object sender, EventArgs e) { } protected void btn_Click(object sender, EventArgs e) { test = txt.Text; lbl.Text = test; } } now i want to make the dll of my default.aspx.cs file and remove it from the website and give the reference of it. so how can i do this??

    Read the article

  • How can I remove the present view when I have added more than one subView ?

    - by srikanth rongali
    How can I remove the present view when I touched the close button. I did [self.view removeFromSuperView] when I added only one subView. It worked. But, I have now added another subView to the previous subView. I need to to get the parent view . How can I do it. My code of adding the subView is here. When I did the following only one view is removed. //FirstViewController: UIViewController -(void)libraryFunction:(id)sender { LibraryController *libraryController = [[LibraryController alloc]init]; [self.view addSubview:libraryController.view]; } //LibraryController: UIViewController -(void)viewDidLoad{ RootViewController *rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStylePlain]; UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController]; self.navController = aNavigationController; [aNavigationController release]; [rootViewController release]; [self.view addSubview:navController.view]; } //RootViewController: UITableViewController - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStyleBordered target:self action:@selector(close:)]; } -(void)close:(id)sender { [self.view removeFromSuperview]; } Thank You.

    Read the article

  • How can I edit an incoming text message (sms) as it arrives in windows mobile 6 using managed code

    - by x86shadow
    I want to make an application for pocket PCs to send and receive Encrypted text messages. I have already made an application that gets special text messages ( starting with !farenc! ) and I know how to Encrypt/Decrypt the messages as well. The problem is that I don't know how to edit a text message after it's arrived (for decryption). See code below for more info. using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.WindowsMobile; using Microsoft.WindowsMobile.PocketOutlook; using Microsoft.WindowsMobile.PocketOutlook.MessageInterception; namespace SMSDECRYPT { public partial class Form1 : Form { MessageInterceptor _SMSCatcher = new MessageInterceptor(InterceptionAction.Notify, true); MessageCondition _SMSFilter = new MessageCondition(); public Form1() { InitializeComponent(); _SMSFilter.Property = MessageProperty.Body; _SMSFilter.ComparisonType = MessagePropertyComparisonType.StartsWith; _SMSFilter.CaseSensitive = true; _SMSFilter.ComparisonValue = "!farenc!"; _SMSCatcher.MessageCondition = _SMSFilter; _SMSCatcher.MessageReceived += new MessageInterceptorEventHandler(_SMSCatcher_MessageReceived); } private void Form1_Load(object sender, EventArgs e) { //... } void _SMSCatcher_MessageReceived(object sender, MessageInterceptorEventArgs e) { SmsMessage mySMS = (SmsMessage)e.Message; string sms = mySMS.Body.ToString(); sms = sms.Substring(8); //Decryption //... //Update the received message and replace it with the decrypted text //!!!HELP!!! } } }

    Read the article

  • How to fix: unrecognized selector sent to instance

    - by Matt
    I am having a problem that may be simple to fix, but not simple for me to debug. I simple have a button inside a view in IB; the file's owner is set to the view controller class I am using and when making the connections, everything seems fine, ie. the connector is finding the method I am trying to call etc. however, I am receiving this error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIApplication getStarted:]: unrecognized selector sent to instance 0x3d19130' My code is as follows: RootViewController.h @interface RootViewController : UIViewController { IBOutlet UIButton* getStartedButton; } @property (nonatomic, retain) UIButton* getStartedButton; - (IBAction) getStarted: (id)sender; @end RootViewController.m #import "RootViewController.h" #import "SimpleDrillDownAppDelegate.h" @implementation RootViewController @synthesize getStartedButton; - (void)viewDidLoad { [super viewDidLoad]; } - (IBAction) getStarted: (id)sender { NSLog(@"Button Tapped!"); //[self.view removeFromSuperview]; } - (void)dealloc { [getStartedButton release]; [super dealloc]; } @end Seems simple enough...any thoughs?

    Read the article

  • Fading in and fading out for a form

    - by karthik
    hi i have a requirement in which my form is transparent,if my mouse enters into it the form should became visible,if my mouse leaves out of the form it becomes transparent, i have three different controls placed in my form , each controls mouse leave and mouse enter is the same that of the form . if my mouse enters into the form and enters into a control form_mouseleaveevent and control_mouseenterd gets fired so iam not able to achieve it,how to overcome this. below is the piece of code for this: private void TransToOpac() { if (!isTransparent) return; if (TtoOON == false ) { TtoOON = true; for (i = this.Opacity; i <= 1; i = i + 0.02) { this.Opacity = i; Thread.Sleep(50); } isTransparent = false; TtoOON = false; } } private void OpacToTrans() { if (isTransparent) return; if (OtoTON == false ) { OtoTON = true; for (i = this.Opacity; i >= 0.5; i = i - 0.02) { this.Opacity = i; Thread.Sleep(50); } isTransparent = true; OtoTON = false; } } private void OnMouseEntered(object sender, EventArgs e) { TransToOpac(); } private void OnMouseLeft(object sender, EventArgs e) { OpacToTrans(); }

    Read the article

  • Displaying modal view in Objective-C

    - by kpower
    I'm trying to display Modal View in my app. I have subclass of UIViewController that has only the "Done" button (UIButton created with IB and linked with XCode). .h @interface myModalVC : UIViewController { UIButton *bDone; } @property (nonatomic, retain) IBOutlet UIButton *bDone; - (IBAction)bDoneTouchDown:(id)sender; @end .m #import "myModalVC.h" @implementation myModalVC @synthesize bDone; - (void)dealloc { [bDone release]; [super dealloc]; } - (void)viewDidLoad { [super viewDidLoad]; } - (void)viewDidUnload { } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (UIInterfaceOrientationLandscapeLeft == interfaceOrientation || UIInterfaceOrientationLandscapeRight == interfaceOrientation); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (IBAction)bDoneTouchDown:(id)sender { [self.parentViewController dismissModalViewControllerAnimated:YES]; } @end I'm trying to display modal view with this code (from my main view): myModalVC *temp = [[[myModalVC alloc] initWithNibName:@"myModalVC" bundle:[NSBundle mainBundle]] autorelease]; [self presentModalViewController:temp animated:YES]; If this code is placed in some method, that responds to button touches - everything is fine. But when I place it to some other method (called during some processes in my app) - modal view is displayed without problems, but when I press (touch) "Done" button, application crashes with "Program received signal: “EXC_BAD_ACCESS”." What am I doing wrong?

    Read the article

  • Creating Actions from UIActionSheets help

    - by user337174
    I am using two UIAction sheets within my current project. I can get one to work perfectly fine but when i insert a second action sheet it runs the same arguements as the first. How do i define the actionsheets seperatly? -(IBAction) phoneButtonClicked:(id)sender { // open a dialog with just an OK button UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:[NSString stringWithFormat:@"Phone: %@",phone],nil]; actionSheet.actionSheetStyle = UIActionSheetStyleDefault; [actionSheet showInView:self.view]; // show from our table view (pops up in the middle of the table) [actionSheet release]; } -(IBAction) mapButtonClicked:(id)sender { // open a dialog with just an OK button UIActionSheet *mapActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:[NSString stringWithFormat:@"Map"],nil]; mapActionSheet.actionSheetStyle = UIActionSheetStyleDefault; [mapActionSheet showInView:self.view]; // show from our table view (pops up in the middle of the table) [mapActionSheet release]; } -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if(buttonIndex == 0){ NSString *callPhone = [NSString stringWithFormat:@"tel:%@",phone]; NSLog(@"Calling: %@", callPhone); [[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]]; } }

    Read the article

  • BackgroundWorker

    - 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

  • visual studio 2008 (VB)

    - by Ousman
    hello guys, Am writing a programming with visual basic 2008 and i want the programme to be able to read and loop through a text file line by line and showing the event of the loop on a textbox or label until a button is press and the loop will stop on any number that happend to be at the loop event and when a button is press again the loop will continue from where it starts. this is my codes below and having problem with it and any help will be really great. tanks ==========================my codes======================= Imports System.IO '========================================================================================== Public Class Form1 '====================================================================================== 'Dim nFileNum As Integer = FreeFile() ' Get a free file number Dim strFileName As String = "C:\scb.txt" Dim objFilename As FileStream = New FileStream(strFileName, FileMode.Open, FileAccess.Read, FileShare.Read) Dim objFileRead As StreamReader = New StreamReader(objFilename) 'Dim lLineCount As Long 'Dim sNextLine As String '====================================================================================== '======================================================================================== Private Sub btStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btStart.Click Try If objFileRead.ReadLine = Nothing Then MsgBox("No Accounts Available to show!", MsgBoxStyle.Information, MsgBoxStyle.DefaultButton2 = MsgBoxStyle.OkOnly) Return Else Do While (objFileRead.Peek() > -1) Loop lblAccounts.Text = objFileRead.ReadLine() 'objFileRead.Close() 'objFilename.Close() End If Catch ex As Exception MessageBox.Show(ex.Message) Finally 'objFileRead.Close() 'objFilename.Close() End Try End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class

    Read the article

  • Devexpress Repository ComboBoxEdit loosing cursor position. Edit.SelectionStart Not being assigned

    - by user575219
    I am having an issue with my comboBoxEdit in a gridcontrol. I am using Winforms Devepress 11.2. I clicked in the text of an existing Repository comboBoxEdit, and typed in "appear backwards", however, it displayed as "sdrawkcab raeppa" like it would in a mirror. There are some posts about this topic but none of the solutions seem to work The reason for this is the following foreach (GridColumn column in this.gvNotes.Columns) { var columnEdit = column.ColumnEdit; if (columnEdit != null) { column.ColumnEdit.EditValueChanged += this.PostEditValueChanged; } } private void PostEditValueChanged(object sender, EventArgs e) { this.gvNotes.PostEditor(); } This PostEditor ensures the save button is enabled when the user is still in the current cell. The user does not need to leave the cell or change column for the changes to be posted to the grid. So this is what I did: private void PostEditValueChanged(object sender, EventArgs e) { ComboBoxEdit edit = this.gridNotes.FocusedView.ActiveEditor as ComboBoxEdit; if (edit != null) { int len = edit.SelectionLength; int start = edit.SelectionStart; gridNotes.FocusedView.PostEditor(); edit.SelectionLength = len; edit.SelectionStart = start; } This did not solve the problem of the cursor resetting to the start position. Edit.SelectionStart is not being assinged to the len value.Even though len changes to 1 edit.SelectionStart remains at 0 Does anyone know what event needs to be handled to not loose the cursor position?

    Read the article

  • How do I use HTML5's localStorage in a Google Chrome extension?

    - by davidkennedy85
    I am trying to develop an extension that will work with Awesome New Tab Page. I've followed the author's advice to the letter, but it doesn't seem like any of the script I add to my background page is being executed at all. Here's my background page: <script> var info = { poke: 1, width: 1, height: 1, path: "widget.html" } chrome.extension.onRequestExternal.addListener(function(request, sender, sendResponse) { if (request === "mgmiemnjjchgkmgbeljfocdjjnpjnmcg-poke") { chrome.extension.sendRequest( sender.id, { head: "mgmiemnjjchgkmgbeljfocdjjnpjnmcg-pokeback", body: info, } ); } }); function initSelectedTab() { localStorage.setItem("selectedTab", "Something"); } initSelectedTab(); </script> Here is manifest.json: { "update_url": "http://clients2.google.com/service/update2/crx", "background_page": "background.html", "name": "Test Widget", "description": "Test widget for mgmiemnjjchgkmgbeljfocdjjnpjnmcg.", "icons": { "128": "icon.png" }, "version": "0.0.1" } Here is the relevant part of widget.html: <script> var selectedTab = localStorage.getItem("selectedTab"); document.write(selectedTab); </script> Every time, the browser just displays null. The local storage isn't being set at all, which makes me think the background page is completely disconnected. Do I have something wired up incorrectly?

    Read the article

  • Delphi set Panel visible after post

    - by Daan Kleijngeld
    this is my code: if DRelatiebeheer.ContactpersoonID.Post = Action then KJSMDBGrid1.RefreshData; KJPanel4.Visible := true; my question is how can i set the panel on visible when the post is succesfully ended. I dont know how to fix it, tried many ways but didn't find a solution for the problem. I think the code doesn't work, because i put it invisible on the OnGetCellParams event. And I only want to set the last panel visible when the information is posted procedure TFRelatiebeheer.KJSMDBGrid1GetCellParams(Sender: TObject); begin if DRelatiebeheer.ACCID.AsInteger <= 0 then KJPanel3.Visible := false; KJPanel4.Visible := false; else begin KJPanel3.Visible := true; end; this is my OnGetCellParams event, this is the other procedure TFRelatiebeheer.SaveCancel(Sender: TObject); begin if (DRelatiebeheer.CID.State in [dsEdit, dsInsert]) then DRelatiebeheer.CID.Post; DRelatiebeheer.AID.Post; if DRelatiebeheer.CID.Post = Action then KJSMDBGrid1.RefreshData; KJPanel4.Visible := true; end;

    Read the article

  • C# Step by Step Execution

    - by Sheldon
    Hi. I'm building an app that uses and scanner API and a image to other format converter. I have a method (actually a click event) that do this: private void ButtonScan&Parse_Click(object sender, EventArgs e) { short scan_result = scanner_api.Scan(); if (scan_result == 1) parse_api.Parse(); // This will check for a saved image the scanner_api stores on disk, and then convert it. } The problem is that the if condition (scan_result == 1) is evaluated inmediatly, so it just don't work. How can I force the CLR to wait until the API return the convenient result. NOTE Just by doing something like: private void ButtonScan&Parse_Click(object sender, EventArgs e) { short scan_result = scanner_api.Scan(); MessageBox.Show("Result = " + scan_result); if (scan_result == 1) parse_api.Parse(); // This will check for a saved image the scanner_api stores on disk, and then convert it. } It works and display the results. Is there a way to do this, how? Thank you very much!

    Read the article

  • StackPanel loded is not getting fired in.cs page

    - by prince23
    <sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <StackPanel Loaded ="SPImage_Loaded" Orientation="Horizontal" Background="Transparent" > <Button x:Name="myButton" Click="Btn_Click"> <Image x:Name="imgMarks" " Stretch="None"/> </Button> </StackPanel> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> in .cs i have defined the event for stack panel private void SPImage_Loaded(object sender, RoutedEventArgs e) { try { var TargetMarks = sender as StackPanel; Image imgMarks= (Image)TargetScore.FindName("imgMarks"); Marks obj = (Marks )TargetMarks.DataContext; // here marks oject would be containg the details // here if marks.score object value is 1 then bind the image //else // dnt bind the image . that is logic i am trying to do. imgMarks.Source = new BitmapImage(new Uri("/Images/a1.png", UriKind.Relative)); } catch (Exception) { throw; } } any solution on this would be great. is there any better solution to achive this. plz help me out. thank you.

    Read the article

  • dynamic LinkButton OnClick event not working on ASP.Net

    - by user1004472
    I want to create dynamic LinkButton for image, <img> tag is not working dynamically so I am using LinkButton with image. I don't want to provide ID to LinkButton because I want to generate more LinkButton dynamically. I am using following code in Default.aspx <%@ Page Language="C#"%> <!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> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { Response.Write(@"<asp:LinkButton runat=""server"" OnClick=""btn_click""><img src=""close-icon (1).png"" /></asp:LinkButton>"); } public void btn_click(object sender, EventArgs e) { Response.Write("HELLO"); } </script> </head> <body> <form id="form1" runat="server"> <div> </div> </form> </body> </html> I also tried to write tag code in Default.aspx.cs file but not work. It's showing me following error. Error 1 'ASP.default_aspx' does not contain a definition for 'img_Click' and no extension method 'img_Click' accepting a first argument of type 'ASP.default_aspx' could be found (are you missing a using directive or an assembly reference?) Please help me to solve this problem.

    Read the article

  • Cocoa - calling a VIEW method from the CONTROLLER

    - by eemerge
    Hello everyone, Got a little problem i asked about it before but maybe i didnt ask properly. I have a cocoa application, which amongst other things, must do the following task: - load some images from the disk, store them in an array and display them in a custom view. In the Interface Builder i have a CustomView and an OBJECT that points to TexturesController.h The custom view is a custom class, TextureBrowser. Below is the code for the controller and view: TexturesController #import <Cocoa/Cocoa.h> @class TextureBrowser; @interface TexturesController : NSObject { IBOutlet NSTextField *logWindow; IBOutlet TextureBrowser *textureView; NSMutableArray *textureList; } @property textureView; -(IBAction)loadTextures:(id)sender; -(IBAction)showTexturesInfo:(id)sender; @end TextureBrowser @interface TextureBrowser : NSView { NSMutableArray *textures; } @property NSMutableArray *textures; -(void)loadTextureList:(NSMutableArray *)source; @end These are just the headers. Now , what i need to do is: when loadTextures from the TexturesController is called, after i load the images i want to send this data to the view (TextureBrowser), for example, store it in the NSMutableArray *textures. I tried using the -(void)loadTextureList:(NSMutableArray*)source method from the view, but in the TextureController.m i get a warning : No -loadTextureList method found This is how i call the method : [textureView loadTextureList: textureList]; And even if i run it with the warning left there, the array in the view class doesnt get initialised. Maybe im missing something...maybe someone can give a simple example of what i need to do and how to do it (code). Thanks in advance.

    Read the article

  • Using Memcached in Python/Django - questions.

    - by Thomas
    I am starting use Memcached to make my website faster. For constant data in my database I use this: from django.core.cache import cache cache_key = 'regions' regions = cache.get(cache_key) if result is None: """Not Found in Cache""" regions = Regions.objects.all() cache.set(cache_key, regions, 2592000) #(2592000sekund = 30 dni) return regions For seldom changed data I use signals: from django.core.cache import cache from django.db.models import signals def nuke_social_network_cache(self, instance, **kwargs): cache_key = 'networks_for_%s' % (self.instance.user_id,) cache.delete(cache_key) signals.post_save.connect(nuke_social_network_cache, sender=SocialNetworkProfile) signals.post_delete.connect(nuke_social_network_cache, sender=SocialNetworkProfile) Is it correct way? I installed django-memcached-0.1.2, which show me: Memcached Server Stats Server Keys Hits Gets Hit_Rate Traffic_In Traffic_Out Usage Uptime 127.0.0.1 15 220 276 79% 83.1 KB 364.1 KB 18.4 KB 22:21:25 Can sombody explain what columns means? And last question. I have templates where I am getting much records from a few table (relationships). So in my view I get records from one table and in templates show it and related info from others. Generating page last a few seconds for very small table (<100records). Is it some easy way to cache queries from templates? Have I to do some big structure in my view (with all related tables), cache it and send to template?

    Read the article

  • iPhone app. Creating a custom UIView that contains UITextField and UIButton.

    - by Dmitry Burchik
    Hi all. I am new to iPhone programming. And I have an issue. I need to create a custom user control that I will add to my UIScrollView dinamically. The control has an UITextField and an UIButton. See the code below: #import <UIKit/UIKit.h> @interface FieldWithValueControl : UIView { UITextField *txtTagName; UIButton *addButton; } @property (nonatomic, readonly) UITextField *txtTagName; @property (nonatomic, readonly) UIButton *addButton; @end #import "FieldWithValueControl.h" #define ITEM_SPACING 10 #define ITEM_HEIGHT 20 #define SWITCHBOX_WIDTH 100 #define SCREEN_WIDTH 320 #define ITEM_FONT_SIZE 14 #define TEXTBOX_WIDTH 150 @implementation FieldWithValueControl @synthesize txtTagName; @synthesize addButton; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code txtTagName = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, TEXTBOX_WIDTH, ITEM_HEIGHT)]; txtTagName.borderStyle = UITextBorderStyleRoundedRect; addButton = [UIButton buttonWithType:UIButtonTypeContactAdd]; [addButton setFrame:CGRectMake(ITEM_SPACING + TEXTBOX_WIDTH, 0, ITEM_HEIGHT, ITEM_HEIGHT)]; [addButton addTarget:self action:@selector(addButtonTouched:) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:txtTagName]; [self addSubview:addButton]; } return self; } - (void)addButtonTouched:sender { UIButton *button = (UIButton*)sender; NSString *title = [button titleLabel].text; } - (void)drawRect:(CGRect)rect { // Drawing code } - (void)dealloc { [txtTagName release]; [addButton release]; [super dealloc]; } @end In my code I create an object of that class and add it to scrollView on form. FieldWithValueControl *newTagControl = (FieldWithValueControl*)[[FieldWithValueControl alloc] initWithFrame:CGRectMake(ITEM_SPACING, currentOffset + ITEM_SPACING, 0, 0)]; [scrollView addSubview:newTagControl]; The control looks fine, but if I click to the textbox or to the button nothing happens. Keyboard doesn't appear, the button is not clickable etc.

    Read the article

  • threading in c#

    - by I__
    i am using this code: private void Form1_Load(object sender, EventArgs e) { } private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { string response = serialPort1.ReadLine(); this.BeginInvoke(new MethodInvoker( () => textBox1.AppendText(response + "\r\n") )); } ThreadStart myThreadDelegate = new ThreadStart(ThreadWork.DoWork); Thread myThread = new Thread(myThreadDelegate); myThread.Start(); but am getting lots of errors: Error 2 The type or namespace name 'ThreadStart' could not be found (are you missing a using directive or an assembly reference?) C:\Users\alexluvsdanielle\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.cs 31 44 WindowsFormsApplication1 Error 3 The name 'ThreadWork' does not exist in the current context C:\Users\alexluvsdanielle\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.cs 31 56 WindowsFormsApplication1 Error 4 The type or namespace name 'Thread' could not be found (are you missing a using directive or an assembly reference?) C:\Users\alexluvsdanielle\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.cs 32 31 WindowsFormsApplication1 Error 5 A field initializer cannot reference the non-static field, method, or property 'WindowsFormsApplication1.Form1.myThreadDelegate' C:\Users\alexluvsdanielle\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.cs 32 38 WindowsFormsApplication1 what am i doing wrong?

    Read the article

  • How to print each object in a collection in a separate page in Silverlight

    - by Ash
    I would like to know if its possible to print each object in a collection in separate pages using Silverlight printing API. Suppose I have a class Label public class Label { public string Address { get; set; } public string Country { get; set; } public string Name { get; set; } public string Town { get; set; } } I can use print API and print like this. private PrintDocument pd; private void PrintButton_Click(object sender, RoutedEventArgs e) { pd.Print("Test Print"); } private void pd_PrintPage(object sender, PrintPageEventArgs e) { Label labelToPrint = new Label() { Name = "Fake Name", Address = "Fake Address", Country = "Fake Country", Town = "Town" }; var printpage = new LabelPrint(); printpage.DataContext = new LabelPrintViewModel(labelToPrint); e.PageVisual = printpage; } LabelPrint Xaml <StackPanel x:Name="LayoutRoot" VerticalAlignment="Center" HorizontalAlignment="Center"> <TextBlock Text="{Binding Name}" /> <TextBlock Text="{Binding Address}" /> <TextBlock Text="{Binding Town}" /> <TextBlock Text="{Binding Country}" /> </StackPanel> Now, say I've a collection of Label objects, List<Label> labels = new List<Label>() { labelToPrint, labelToPrint, labelToPrint, labelToPrint }; How can I print each object in the list in separate pages ? Thanks for any suggestions ..

    Read the article

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