Search Results

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

Page 122/174 | < Previous Page | 118 119 120 121 122 123 124 125 126 127 128 129  | Next Page >

  • Binding Data to DataGridView in VB.Net

    - by Peter
    Hi, I have a bit of code which loads data from a stored procedure in MS SQL Server and then loads the data to a datagridview, which works fine. What i want is for the code that connects / loads the data to sit in my Database Class and then everything associated with the datagridview to be stored in my Form but i am having problems passing the contents of the bindingsource over to the Form from the Database Class. Form1 Public Class Form1 Dim myDatabaseObj As New Class1() Dim bindingSource1 As New BindingSource() Dim connectString As New SqlConnection Dim objDataAdapter As New SqlDataAdapter Dim table As New DataTable() Dim tabletest As New DataTable() Private Sub loadCompanyList() Try Me.dgv_CompanyList.DataSource = Me.bindingSource1 getCompanyList() Catch ex As NullReferenceException End Try End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load loadCompanyList() End Sub End Class Database Class When i try place the getCompanyList() in a class and then create a new object that references the Form() it does not seem to return any value from the table to the MyForm.BindingSource1.Datasource meaning my datagridview displays not data. ..... Private Sub getCompanyList() Try Dim myForm as new Form() connect_Transaction_Database() objDataAdapter.SelectCommand = New SqlCommand() objDataAdapter.SelectCommand.Connection = connectString objDataAdapter.SelectCommand.CommandText = "sp_GetCompanyList" objDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure Dim commandBuilder As New SqlCommandBuilder(Me.objDataAdapter) Dim table As New DataTable() table.Locale = System.Globalization.CultureInfo.InvariantCulture Me.objDataAdapter.Fill(table) **MyForm.bindingSource1.DataSource = table** Catch ex As DataException MsgBox(ex.Message) Catch ex As NullReferenceException MsgBox(ex.Message) End Try disconnect_Transaction_Database() End Sub If anyone could help. Thank you. Peter

    Read the article

  • Uploading image with AsynFileUpload(ACT Control) and changing Image Url of an Image Control??

    - by mahdiahmadirad
    Hi! I Used AsyncFileUpload(one of Ajac Control Toolkit Controls) to Uploading User's Image. this works well. But i want to change the image url of an image contorl to uploaded image url. how can i perform that? I put Image control in a Update Panel: <asp:UpdatePanel ID="UpdatePanelNew" runat="server"> <ContentTemplate> <asp:Image ID="Image1" ImageUrl="~/Images/Categories/NoCategory.png" runat="server" /> </ContentTemplate> </asp:UpdatePanel> <asp:AsyncFileUpload OnClientUploadError="uploadError" OnClientUploadComplete="uploadComplete" runat="server" ID="AsyncFileUpload1" UploadingBackColor="#CCFFFF" ThrobberID="myThrobber" /> &nbsp; <asp:Label ID="myThrobber" runat="server" Style="display: none;"> <img align="middle" alt="Working..." src="../../Images/App/uploading.gif" /> </asp:Label> in C# code I wrote these: protected void Page_Init() { AsyncFileUpload1.UploadedComplete += new EventHandler<AsyncFileUploadEventArgs>(AsyncFileUpload1_UploadedComplete); } void AsyncFileUpload1_UploadedComplete(object sender, AsyncFileUploadEventArgs e) { ScriptManager.RegisterStartupScript(this, this.GetType(), "size", "top.$get(\"" + uploadResult.ClientID + "\").innerHTML = 'Uploaded size: " + AsyncFileUpload1.FileBytes.Length.ToString() + "';", true); string savePath = MapPath("~/Images/Categories/" + Path.GetFileName(e.filename)); ImageOperations.ResizeFromStream(savePath, 128, AsyncFileUpload1.FileContent); Image1.ImageUrl = "~/Images/Categories/" + AsyncFileUpload1.FileName; //AsyncFileUpload1.SaveAs(savePath); } But it does not work. can you help me? Note that ImageOperations.ResizeFromStream() method resizes and saves the image to a specefic folder. actually I should trigger a Postback to Update the Update Panel but How to do that. I used UpdatePanelNew.Update(); but it does not work!

    Read the article

  • What could be causing a "Cannot access a disposed object" error in WCF?

    - by Nima
    I am using the following code: private WSHttpBinding ws; private EndpointAddress Srv_Login_EndPoint; private ChannelFactory<Srv_Login.Srv_ILogin> Srv_LoginChannelFactory; private Srv_Login.Srv_ILogin LoginService; The Login is my constructor: public Login() { InitializeComponent(); ws = new WSHttpBinding(); Srv_Login_EndPoint = new EndpointAddress("http://localhost:2687/Srv_Login.svc"); Srv_LoginChannelFactory = new ChannelFactory<Srv_Login.Srv_ILogin>(ws, Srv_Login_EndPoint); } And I'm using service this way: private void btnEnter_Click(object sender, EventArgs e) { try { LoginService = Srv_LoginChannelFactory.CreateChannel(); Srv_Login.LoginResult res = new Srv_Login.LoginResult(); res = LoginService.IsAuthenticated(txtUserName.Text.Trim(), txtPassword.Text.Trim()); if (res.Status == true) { int Id = int.Parse(res.Result.ToString()); } else { lblMessage.Text = "Not Enter"; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Srv_LoginChannelFactory.Close(); } } When the user enters a valid username and password, everything is fine. When the user enters a wrong username and password, the first try correctly displays a "Not Enter" message, but on the second try, the user sees this message: {System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.ServiceModel.ChannelFactory`1[Test_Poosesh.Srv_Login.Srv_ILogin]'. at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposed() at System.ServiceModel.ChannelFactory.EnsureOpened() at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via) at System.ServiceModel.ChannelFactory`1.CreateChannel() How can I fix my code to prevent this error from occurring?

    Read the article

  • How to open a help webpage after installation is complete

    - by Kapil
    I have built an installer for my windows app using the VisualStudio 2008 IDE. I also use some custom-actions to do a few extra stuff at the time of installation/uninstallation. What I also want to do is that when the installation is completed, the installer should launch a help webpage or a getting-started page for the users to know how to go ahead with the app. I am doing the following for this: private void CustomInstaller_Committed(object sender, InstallEventArgs e) { System.Windows.Forms.LinkLabel lbl = new System.Windows.Forms.LinkLabel(); lbl.Links.Remove(lbl.Links[0]); lbl.Links.Add(0, lbl.Text.Length, "http://www.mywebsite.com/help.aspx"); ProcessStartInfo pInfo = new ProcessStartInfo(lbl.Links[0].LinkData.ToString()); Process.Start(pInfo); } Also, I set the event handler as such: this.Committed += new InstallEventHandler(CustomInstaller_Committed); This is launching the webpage, but not at the right point in the flow where I would have wanted it. It launches the IE browser even before the user dismisses the installation window (i.e clicks 'Close' in the Installation Completed dialog box). I want the webpage to open only when the user finally dismisses the installation. Any ideas how can I achieve this? Thanks, Kapil

    Read the article

  • WPF: ListView inside LIstViewItem: How to support button_click

    - by Bartek
    Hi I have problem with using buttons that are placed in the itemtemplate of the listview which is placed in the itemtemplate of the outer listview. I'll try to simplify the code to show only the idea. I have a objects collection which looks like this: Main object contains a list of innerObjects. Every innerObject contains a list of objects that contain some strings. mainObject listItem innerListItem string string innerListItem string string listItem innerListItem string string I set a mainObject as a itemsSource to the ListView. This listView has a ItemTemplate. This ItemTemplate contains some buttons and inner ListView. Inner ListView also has the item template that contains a button (deleteButton). Pressing this deleteButton I want to delete items (innerListItem) for which this button was created. I can use such functionality when I have a sigle listView. private void clearAndList_Click(object sender, RoutedEventArgs e) { DependencyObject dep = (DependencyObject)e.OriginalSource; while ((dep != null) && !(dep is System.Windows.Controls.ListViewItem)) { dep = VisualTreeHelper.GetParent(dep); } if (dep == null) { return; } ANDconditionsList andList = (ANDconditionsList)ConditionsList.ItemContainerGenerator.ItemFromContainer(dep); orConditionsList.RemoveConditionsSet(andList); } I can't use the same functionality because I can only use the name of the ConditionsList which is the mail listview. The idea is to find the innerlistview and use it instead of ConditionsList, however I don't know if it will work. If anyone have some samples concerning using listview in listview or how to operate the button in a different way please help me

    Read the article

  • C# serialPort speed

    - by MarekK
    Hi I am developing some monitoring tool for some kind of protocol based on serial communication. Serial BaudRate=187,5kb I use System.IO.Ports.SerialPort class. This protocol has 4 kinds of frames. They have 1Byte,3Bytes,6Bytes, 10-255Bytes. I can work with them but I receive them too late to respond. For the beginning I receive first packed after ex. 96ms (too late), and it contains about 1000B. This means 20-50 frames (too much, too late). Later its work more stable, 3-10Bytes but it is still too late because it contains 1-2 frames. Of Course 1 frame is OK, but 2 is too late. Can you point me how can I deal with it more reliable? I know it is possible. Revision1: I tried straight way: private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e) { if (!serialPort1.IsOpen) return; this.BeginInvoke(new EventHandler(this.DataReceived)); } And Backgroud worker: And ... new Tread(Read) and... always the same. Too late, too slow. Do I have to go back to WinApi and import some kernel32.dll functions? Revision 2: this is the part of code use in the Treading way: int c = serialPort1.BytesToRead; byte[] b = new byte[c]; serialPort1.Read(b, 0, c); I guess it is some problem with stream use inside SerialPort class. Or some synchronization problem. Revision 3: I do not use both at once!! I just tried different ways. Regards MarekK

    Read the article

  • How can I get a Silverlight application to check for an update without the user clicking a button?

    - by Edward Tanguay
    I have made an out-of-browser silverlight application which I want to automatically update every time there is a new .xap file uploaded to the server. When the user right-clicks the application and clicks on Updates, the default is set to "Check for updates, but let me choose whether to download and install them": This leads me to believe that it is possible to make my Silverlight application automatically detect if there is a new .xap file present on the server, and if there is, the Silverlight client will automatically ask the user if he would like to install it. This however is not the case. I upload a new .xap file and the Silverlight application does nothing. Even if I add this to my App.xaml.cs: -- private void Application_Startup(object sender, StartupEventArgs e) { this.RootVisual = new BaseApp(); if (Application.Current.IsRunningOutOfBrowser) { Application.Current.CheckAndDownloadUpdateAsync(); } } and update the .xap file, the Silverlight application does nothing. This information leads me to believe that I have to make a button which the user clicks to see if there is an update. But I don't want the user to have to click a button every day to see if there is an update. I want the application to check by itself if there is a new .xap file and if there is, let the client ask the user if he wants the update. How do I make my Silverlight application check, each time it starts, if there is a new .xap file, and if there is, pass control to the Silverlight client to ask the user if he wants to download it, as the above dialogue implies is possible?

    Read the article

  • STOP Application Pool Issue Programitically IIS7

    - by Sumit Kute
    In my application I needs to stop a application pool programmitically in IIS 7. I have created a local acccount and given him Administrative Priviledges. Here is the code Private static void StopApplication() { string serviceHostDeploymentType = "local"; if (serviceHostDeploymentType.Equals("local")) { WindowsIdentityImpersonate newIdentity = new WindowsIdentityImpersonate(); if (newIdentity.Impersonate("AccountName", Environment.MachineName, "Password")) { try { ServerManager serverManager = ServerManager.OpenRemote("Server"); string siteName = GetWebSiteNameById(serverManager, 1); Site parentWebsite = serverManager.Sites[siteName]; if (parentWebsite != null) { ApplicationPool apppool = serverManager.ApplicationPools["Application Pool Name"]; if (apppool != null) { apppool.Stop(); } } } finally { newIdentity.Undo(); } } } else { throw new ConfigurationErrorsException("..."); } } I am getting an error Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). Stack Trace at Microsoft.Web.Administration.Interop.IAppHostMethodInstance.Execute() at Microsoft.Web.Administration.ConfigurationElement.ExecuteMethod(String methodName) at Microsoft.Web.Administration.ApplicationPool.Stop() at ServerManagerTesting.Form1.StopApplication() at ServerManagerTesting.Form1.button1_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at ServerManagerTesting.Program.Main() at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

    Read the article

  • Lambdas within Extension methods: Possible memory leak?

    - by Oliver
    I just gave an answer to a quite simple question by using an extension method. But after writing it down i remembered that you can't unsubscribe a lambda from an event handler. So far no big problem. But how does all this behave within an extension method?? Below is my code snipped again. So can anyone enlighten me, if this will lead to myriads of timers hanging around in memory if you call this extension method multiple times? I would say no, cause the scope of the timer is limited within this function. So after leaving it no one else has a reference to this object. I'm just a little unsure, cause we're here within a static function in a static class. public static class LabelExtensions { public static Label BlinkText(this Label label, int duration) { Timer timer = new Timer(); timer.Interval = duration; timer.Tick += (sender, e) => { timer.Stop(); label.Font = new Font(label.Font, label.Font.Style ^ FontStyle.Bold); }; label.Font = new Font(label.Font, label.Font.Style | FontStyle.Bold); timer.Start(); return label; } }

    Read the article

  • Sharing sessions across applications using the ASP.NET Session State Service

    - by Dan
    I am trying to share sessions between two web applications, both hosted on the same server. One is a .net 2.0 web forms application the other is as .net 3.5 MVC2 application. Both apps have their session set up like this: <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" /> In the webform application I am posting the the session key to the MVC app: protected void LinkButton1_Click(object sender, EventArgs e) { Session["myvariable"] = "dan"; string sessionKey = HttpContext.Current.Session.SessionID; //Followed by some code that posts sessionKey to the other application } I then recieve it in the MVC application and try use the same session like this: [HttpPost] public void Recieve(string sessionKey ) { var manager = new SessionIDManager(); bool redirected; bool IsAdded; manager.SaveSessionID(HttpContext.ApplicationInstance.Context, Id, out redirected, out IsAdded); var sessionKey = Session["myvariable"]; } The key is being posted but the session does not seem to get loaded in the MVC app, i.e. sessionKey is null. Can what I am trying to do be done?

    Read the article

  • C# - WinForms - Exception Handling for Events

    - by JustLooking
    Hi all, I apologize if this is a simple question (my Google-Fu may be bad today). Imagine this WinForms application, that has this type of design: Main application - shows one dialog - that 1st dialog can show another dialog. Both of the dialogs have OK/Cancel buttons (data entry). I'm trying to figure out some type of global exception handling, along the lines of Application.ThreadException. What I mean is: Each of the dialogs will have a few event handlers. The 2nd dialog may have: private void ComboBox_SelectedIndexChanged(object sender, EventArgs e) { try { AllSelectedIndexChangedCodeInThisFunction(); } catch(Exception ex) { btnOK.enabled = false; // Bad things, let's not let them save // log stuff, and other good things } } Really, all the event handlers in this dialog should be handled in this way. It's an exceptional-case, so I just want to log all the pertinent information, show a message, and disable the okay button for that dialog. But, I want to avoid a try/catch in each event handler (if I could). A draw-back of all these try/catch's is this: private void someFunction() { // If an exception occurs in SelectedIndexChanged, // it doesn't propagate to this function combobox.selectedIndex = 3; } I don't believe that Application.ThreadException is a solution, because I don't want the exception to fall all the way-back to the 1st dialog and then the main app. I don't want to close the app down, I just want to log it, display a message, and let them cancel out of the dialog. They can decide what to do from there (maybe go somewhere else in the app). Basically, a "global handler" in between the 1st dialog and the 2nd (and then, I suppose, another "global handler" in between the main app and the 1st dialog). Thanks.

    Read the article

  • Boto - How to delete a record set from route53 -Tried to delete resource record set but it was not found

    - by Tampa
    I am using the following to delete route53 records. I get no error messages. conn = Route53Connection(aws_access_key_id, aws_secret_access_key) changes = ResourceRecordSets(conn, zone_id) change = changes.add_change("DELETE",sub_domain, "A", 60,weight=weight,identifier=identifier) change.add_value(ip_old) changes.commit() all required fields are present and they match..weight, identifier, ttl=60 etc.\ e.g. test.com. A 111.111.111.111 60 1 id1 test.com. A 111.111.111.222 60 1 id2 I want to delete 111.111.111.222 and the record set. So, what is the proper way to delete a record set? For a record set, I will have multiple values that are distinguished by a unique identifier. When an ip address becomes in active I want to remove from route53. I am using a a poor mans load balancing. Here is the meta of the record want to delete. {'alias_dns_name': None, 'alias_hosted_zone_id': None, 'identifier': u'15754-1', 'name': u'hui.com.', 'resource_records': [u'103.4.xxx.xxx'], 'ttl': u'60', 'type': u'A', 'weight': u'1'} Traceback (most recent call last): File "/home/ubuntu/workspace/rtbopsConfig/classes/redis_ha.py", line 353, in <module> deleteRedisSubDomains(aws_access_key_id, aws_secret_access_key,platform=platform,sub_domain=sub_domain,redis_domain=redis_domain,zone_id=zone_id,ip_address=ip_address,weight=1,identifier=identifier) File "/home/ubuntu/workspace/rtbopsConfig/classes/redis_ha.py", line 341, in deleteRedisSubDomains changes.commit() File "/usr/local/lib/python2.7/dist-packages/boto-2.3.0-py2.7.egg/boto/route53/record.py", line 131, in commit return self.connection.change_rrsets(self.hosted_zone_id, self.to_xml()) File "/usr/local/lib/python2.7/dist-packages/boto-2.3.0-py2.7.egg/boto/route53/connection.py", line 291, in change_rrsets body) boto.route53.exception.DNSServerError: DNSServerError: 400 Bad Request <?xml version="1.0"?> <ErrorResponse xmlns="https://route53.amazonaws.com/doc/2011-05-05/"><Error><Type>Sender</Type><Code>InvalidChangeBatch</Code><Message>Tried to delete resource record set hui.com., type A, SetIdentifier 15754-1 but it was not found</Message></Error><RequestId>9972af89-cb69-11e1-803b-7bde5b9c457d</RequestId></ErrorResponse> Thanks

    Read the article

  • Exception thrown on secondary workflow

    - by nav
    Hi All, I am running a workflow fired when a new list item is created, the workflow creates a new task item and sends an email. This works fine. I have another workflow fired when a task item is modified, when I try and modify the task item and click complete an exception: I have checked the recycle bin and the item asscociated with the workflow is not there, i have deleted all items for the recycle bin but still get the error... Any help appreciated! Exception details: Server Error in '/' Application. The workflow's parent item associated with this task is currently in the recycle bin, which prevents the task from being completed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Microsoft.SharePoint.SPException: The workflow's parent item associated with this task is currently in the recycle bin, which prevents the task from being completed. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SPException: The workflow's parent item associated with this task is currently in the recycle bin, which prevents the task from being completed.] Microsoft.SharePoint.WebPartPages.DataFormWebPart.UpdateCallback(Int32 affectedRecords, Exception ex) +198 System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +4432739 Microsoft.SharePoint.WebPartPages.DataFormWebPart.FlatCommit() +724 Microsoft.SharePoint.WebPartPages.DataFormWebPart.PerformCommit() +92 Microsoft.SharePoint.WebPartPages.DataFormWebPart.HandleOnSave(Object sender, EventArgs e) +61 Microsoft.SharePoint.WebPartPages.DataFormWebPart.RaisePostBackEvent(String eventArgument) +3651 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +39 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3215

    Read the article

  • Multicolumn ListView in WPF - errors

    - by Will
    Hi, I am trying to define a multicolumn listview in xaml (visual studio 2008) and then add items to it in c#. I have seen many posts on this subject, and tried the various methods, but I am getting errors. my xaml code is below, VS does not flag any errors on it. <ListView Height="234.522" Name="chartListView" Width="266.337"> <ListView.View> <GridView> <GridViewColumn Header="Name" Width="70"/> <GridViewColumn Header="ID" /> </GridView> </ListView.View> </ListView> to try and add data to the columns, I created a button and put the code in the button click : private void button3_Click(object sender, RoutedEventArgs e) { chartListView.Items.Add("item1").SubItems.Add("item2"); } the error that is showing is on Subitems is: 'int' does not contain a definition for 'SubItems' and no extension method 'SubItems' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?) D:\devel\VS\pchart\pchart\pchart\Window1.xaml.cs Also, I tried looking at some other posts on listview controls such as http://stackoverflow.com/questions/1260812/listview-inserting-items i tried the code there : ListViewItem item = new ListViewItem(); item.Text=anInspector.getInspectorName().ToString(); and got almost the same error on item.Text as i did with SubItems. is there something earlier in my code, or project definition that i am missing? Thanks for any help

    Read the article

  • Postback event not firing on FIRST button click..

    - by ClarkeyBoy
    Hi, I have a form which accepts two arguments. The first one is mode - this is either view, new or edit. If it is new then the second argument is type - this is either range, collection or design. When set to new, and the type is valid, a new instance of that type is created and the data from the form is added to it. The item (range, collection or design) then validates the data. If any of the data is invalid then it throws an error, and this error is displayed at the top of the form telling the user why it is invalid. A variable, _Databind, is set to false so that it does not change the data input by the user (in the form fields). The button used to submit the button is called btnSave, and is created in the html source. The click event is wired up in the form Protected Sub Blah(sender, e) Handles btnSave.Click. Strangely, whenever I edit an item that already exists the form submits fine the first time - the click event is fired. However when in "new" mode I have to click the button twice to fire the event. It also blanks all the form fields out on first click. I have even put a Response.Write("Hello World") line at the start of the click event - this is not being output on first click when adding a new item either. It is on first load when the mode is set to edit however. Does anyone have any ideas as to what is causing it to behave this way? Thanks in advance for any help. Regards, Richard

    Read the article

  • toggling proximity sensor on iPhone loses an event

    - by slugolicious
    I'm using setProximitySensingEnabled and implemented proximityStateChanged in my UIApplication subclass. It looks like if sensing is toggled, that the first "off" event is being lost. My UIApplication class is pretty basic... -(void)proximityStateChanged:(BOOL)state { NSLog(state ? @"ON" : @"OFF"); } In my application delegate, I have a UISwitch that enables/disables the proximity sensor. -(IBAction)toggleProxy:(id)sender { [UIApplication sharedApplication].proximitySensingEnabled = prox.on; } "prox" is my UISwitch. The test works fine when it first starts. I tap the switch to turn it on and then put my hand over the sensor for a second then move it away and get: 2009-03-11 12:43:00.465 Proximity[324:20b] ON 2009-03-11 12:43:02.514 Proximity[324:20b] OFF 2009-03-11 12:43:04.046 Proximity[324:20b] ON 2009-03-11 12:43:05.621 Proximity[324:20b] OFF I then tap the switch to turn it off then tap again to turn it on. Now I get: 2009-03-11 12:43:12.005 Proximity[324:20b] ON 2009-03-11 12:43:14.789 Proximity[324:20b] ON 2009-03-11 12:43:16.467 Proximity[324:20b] OFF 2009-03-11 12:43:17.516 Proximity[324:20b] ON 2009-03-11 12:43:19.077 Proximity[324:20b] OFF Notice I get two ON's before an OFF. The OFF is lost somewhere. I can't replicate this behavior using Google's mobile app so I'm wondering if they're resetting something in between proximity enabling. They don't have the proximity sensor on all the time because if you cover the sensor, the screen doesn't go blank. You have to tilt the phone up and angle it back (to simulate the position it would be in at your ear) and then covering the sensor works. Anyone else playing with the sensor? In my particular app, I'm recording a voice message and when you move the phone away from your ear, I want to pause the recording (when I get an OFF). The first time I move the phone away from my ear, the recording is not paused. However, if I put it to my ear and move it away again, it is paused.

    Read the article

  • XML RPC c# Call returns array of strings and int

    - by chillconsulting
    I'm doing an XML RPC call in ASP.net with c# and the call returns an Array called userinfo with strings and integers in it and I can't seem to figure out how to parse the data and put it into string and int objects... The only thing that compiles is if I make it an Object in the struct. The int returns fines and is referenced easily. Any help would be appreciated - this is what I got. public Page_Load(object sender, EventArgs e){ IValidateSSO proxy = XmlRpcProxyGen.Create<IValidateSSO>(); UserInfoSSOValue ret2 = proxy.UserInfoSSO(ssoAuth, ssoValue); int i = ret2.isonid; } public struct UserInfoSSOValue { public Object userinfo; public int isonid; } [XmlRpcUrl("host")] public interface IValidateSSO : IXmlRpcProxy { [XmlRpcMethod("sso.session_userinfo")] UserInfoSSOValue UserInfoSSO(string ssoauth, string sid); } Here is what the xml rpc calls returns (I know it's in php... I'm trying to implement in c#): sso.session_userinfo(string $ssoauth, string $sid) string $ssoauth - authentication string (assigned by ONID support) string $sid - sid to get info on Returns: Array ( [userinfo] => Array ( [lastname] => College [expire_time] => 1118688011 [osuuid] => 12345678901 [sid_length] => 3600 [ip] => 10.0.0.1 [sid] => WiT7ppAEUKS3rJ2lNz3Ue64sGPxnnLL0 [username] => collegej [firstname] => Joe [fullname] => College, Joe Student [email] => [email protected] [create_time] => 1118684410 ) [isonid] => 1 ) array userinfo - array containing basic user information

    Read the article

  • Error when changing default lanuage in asp.net compilation from vb to c#

    - by Herman
    Hi all, We have a updatable web site project that is written in c#, it has the usual web form implementation using master page, skins, user controls,...etc. Up to this point we neglect to change the default compilation language from VB to C#. However, the second we change it, we see the following error. Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at ASP.Default.__DataBinding__control499(Object sender, EventArgs e) at System.Web.UI.Control.OnDataBinding(EventArgs e) at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at .... Further investigation points out that this error is getting generated from a Theme related assembly (Source : App_Theme_Default.zclakrlo). Any ideas? One of my co-worker suggested that it might be skin file related since we have a theme call "Default" and there is no way to specify a language on a skin file. Therefore, when the asp.net runtime tries to compile it under C#, it will give a name collision? Does this make sense? Any help is appreciated.

    Read the article

  • Implementing the outside application „openedFileView“ in c# Project

    - by case23
    I work on a application where i want to find out which files on my filesystem is used by a Process. After trying around with the System.Diagnostics.Process class, and didn´t get the resulst i wanted i find the application called OpenedFileView from Nirsoft. http://www.nirsoft.net/utils/opened_files_view.html Basically it does exactly what i want but i have some problems with the implimication in my project. The option wich “OpenedFileView” gives you is to start it with some arguments that it creates you an txt file with all the information i want. But for my case i want to whach the processes in realtime, and if i start the application repetitively i always have the hourglass at my mouse cursor. So after this i tryed some ways to get rid of it, tryed out to put it in a BackgroundWorker Thread. But this changed nothing at all. I also looked for a way to force the Process not to exit, and sending new arguments to it, but this also didn´t worked. So is there any way to use this application in the way I want, or does this didn´t work at all? I hope somebody can help me either with getting away this annoying mouse cursor hourglass, or with a better implimication of this application so i can use it in realtime! Thanks alot! private void start() { _openedFileView = new Process(); _openedFileView.StartInfo.FileName = "pathToApp\\OpenedFilesView.exe"; _openedFileView.EnableRaisingEvents = true; _openedFileView.Exited += new EventHandler(myProcess_Exited); _openedFileView.StartInfo.Arguments = "/scomma pathToOutputFile"; _openedFileView.Start(); } private void myProcess_Exited(object sender, System.EventArgs e) { start(); }

    Read the article

  • asp.net Dynamic Data Site with own MetaData

    - by loviji
    Hello, I'm searching info about configuring own MetaData in asp.NET Dynamic Site. For example. I have a table in MS Sql Server with structure shown below: CREATE TABLE [dbo].[someTable]( [id] [int] NOT NULL, [pname] [nvarchar](20) NULL, [FullName] [nvarchar](50) NULL, [age] [int] NULL) and I there are 2 Ms Sql tables (I've created), sysTables and sysColumns. sysTables: ID sysTableName TableName TableDescription 1 | someTable |Persons |All Data about Persons in system sysColumns: ID TableName sysColumnName ColumnName ColumnDesc ColumnType MUnit 1 |someTable | sometable_pname| Name | Persona Name(ex. John)| nvarchar(20) | null 2 |someTable | sometable_Fullname| Full Name | Persona Name(ex. John Black)| nvarchar(50) | null 3 |someTable | sometable_age| age | Person age| int | null I want that, in Details/Edit/Insert/List/ListDetails pages use as MetaData sysColumns and sysTableData. Because, for ex. in DetailsPage fullName, it is not beatiful as Full Name . someIdea, is it possible? thanks Updated:: In List Page to display data from sysTables (metaData table) I've modified <h2 class="DDSubHeader"><%= tableName%></h2>. public string tableName; protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); //added by me uqsikDataContext sd=new uqsikDataContext(); tableName = sd.sysTables.Where(n => n.sysTableName == table.DisplayName).FirstOrDefault().TableName; //end GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); GridDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName; if (table.EntityType != table.RootEntityType) { GridQueryExtender.Expressions.Add(new OfTypeExpression(table.EntityType)); } } so, what about sysColums? How can I get Data from my sysColumns table?

    Read the article

  • Updating asp:SqlDataSource Parameter via asp:LinkButton

    - by Mattec
    I'll try to explain what I'm doing the best I can, but I'm pretty new to asp.net so be patient with me. I have a SqlDataSource which returns a simple select statement based on the WHERE clause using @COURSE_ID What I want to-do is every time any one of 2 (this will change as it's going to be generated) asp:LinkButtons are pressed, they will change the @COURSEID value which i'd like to associate with the specific button. Buttons: <asp:LinkButton ID="LinkButton2" runat="server" onclick="MenuUpdate_Click">Course1</asp:LinkButton> <asp:LinkButton ID="LinkButton1" runat="server" onclick="MenuUpdate_Click">Course2</asp:LinkButton> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connString %>" SelectCommand="SELECT Chapter.chapterName, Chapter.chapterID FROM Chapter WHERE Chapter.courseID = @COURSE_ID " C# protected void MenuUpdate_Click(object sender, EventArgs e) { Parameter p = SqlDataSource1.SelectParameters["COURSE_ID"]; SqlDataSource1.SelectParameters.Remove(p); SqlDataSource1.SelectParameters.Add("COURSE_ID", THIS NEEDS TO BE VALUE ASSOCIATED TO BUTTON); ListView1.DataBind(); UpdatePanel1.Update(); } If anyone has any suggestions that'd be great, I've been trying lots of different things all night with no success :( Thanks

    Read the article

  • General Question About WPF Control Behavior and using Invoke

    - by Phil Sandler
    I have been putting off activity on SO because my current reputation is "1337". :) This is a question of "why" and not "how". By default, it seems that WPF does not set focus to the first control in a window when it's opening. In addition, when a textbox gets focus, by default it does not have it's existing text selected. So basically when I open a window, I want focus on the first control of the window, and if that control is a textbox, I want it's existing text (if any) to be selected. I found some tips online to accomplish each of these behaviors, and combined them. The code below, which I placed in the constructor of my window, is what I came up with: Loaded += (sender, e) => { MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); var textBox = FocusManager.GetFocusedElement(this) as TextBox; if (textBox != null) { Action select = textBox.SelectAll; //for some reason this doesn't work without using invoke. Dispatcher.Invoke(DispatcherPriority.Loaded, select); } }; So, my question. Why does the above not work without using Dispatcher.Invoke? Is something built into the behavior of the window (or textbox) cause the selected text to be de-selected post-loading? Maybe related, maybe not--another example of where I had to use Dispatcher.Invoke to control the behavior of a form: http://stackoverflow.com/questions/2602979/wpf-focus-in-tab-control-content-when-new-tab-is-created

    Read the article

  • how to download a file from remote server using asp.net

    - by ush
    The below code works fine for downloading a file from a current pc.plz suggest me how to download it from remote server using ip address or any method protected void Button1_Click(object sender, EventArgs e) { const string fName = @"C:\ITFSPDFbills\February\AA.pdf"; FileInfo fi = new FileInfo(fName); long sz = fi.Length; Response.ClearContent(); Response.ContentType = MimeType(Path.GetExtension(fName)); Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}", System.IO.Path.GetFileName(fName))); Response.AddHeader("Content-Length", sz.ToString("F0")); Response.TransmitFile(fName); Response.End(); } public static string MimeType(string Extension) { string mime = "application/octetstream"; if (string.IsNullOrEmpty(Extension)) return mime; string ext = Extension.ToLower(); Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext); if (rk != null && rk.GetValue("Content Type") != null) mime = rk.GetValue("Content Type").ToString(); return mime; }

    Read the article

  • Need help with creating PDF from HTML using itextsharp

    - by Steven
    I'm trying to crate a PDF out of a HTML page. The CMS I'm using is EPiServer. This is my code so far: protected void Button1_Click(object sender, EventArgs e) { naaflib.pdfDocument(CurrentPage); } public static void pdfDocument(PageData pd) { //Extract data from Page (pd). string intro = pd["MainIntro"].ToString(); // Attribute string mainBody = pd["MainBody"].ToString(); // Attribute // makae ready HttpContext HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = "application/pdf"; // Create PDF document Document pdfDocument = new Document(PageSize.A4, 80, 50, 30, 65); //PdfWriter pw = PdfWriter.GetInstance(pdfDocument, HttpContext.Current.Response.OutputStream); PdfWriter.GetInstance(pdfDocument, HttpContext.Current.Response.OutputStream); pdfDocument.Open(); pdfDocument.Add(new Paragraph(pd.PageName)); pdfDocument.Add(new Paragraph(intro)); pdfDocument.Add(new Paragraph(mainBody)); pdfDocument.Close(); HttpContext.Current.Response.End(); } This outputs the content of the article name, intro-text and main body. But it does not pars HTML which is in the article text and there is no layout. I've tried having a look at http://itextsharp.sourceforge.net/tutorial/index.html without becomming any wiser. Any pointers to the right direction is greatly appreciated :)

    Read the article

  • Why isn't my WPF Datagrid showing data?

    - by Edward Tanguay
    This walkthrough says you can create a WPF datagrid in one line but doesn't give a full example. So I created an example using a generic list and connected it to the WPF datagrid, but it doesn't show any data. What do I need to change on the code below to get it to show data in the datagrid? ANSWER: This code works now: XAML: <Window x:Class="TestDatagrid345.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit" xmlns:local="clr-namespace:TestDatagrid345" Title="Window1" Height="300" Width="300" Loaded="Window_Loaded"> <StackPanel> <toolkit:DataGrid ItemsSource="{Binding}"/> </StackPanel> </Window> Code Behind: using System.Collections.Generic; using System.Windows; namespace TestDatagrid345 { public partial class Window1 : Window { private List<Customer> _customers = new List<Customer>(); public List<Customer> Customers { get { return _customers; }} public Window1() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { DataContext = Customers; Customers.Add(new Customer { FirstName = "Tom", LastName = "Jones" }); Customers.Add(new Customer { FirstName = "Joe", LastName = "Thompson" }); Customers.Add(new Customer { FirstName = "Jill", LastName = "Smith" }); } } }

    Read the article

< Previous Page | 118 119 120 121 122 123 124 125 126 127 128 129  | Next Page >