.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Cursor Position not working on Form_Load

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :Windows Application
This is the only line of code in my Form_Load event and the cursor does not move to the submit button.I've tried to point it at other controls on the form and I get the same result...the cursor moves but to an area on the form (somewhat bottom left) where no control exits. System.Windows.Forms.   Cursor.Position = new Point(btnSubmit.Location.X, btnSubmit.Location.Y);Paul Reed

View Complete Post

More Related Resource Links

Move cursor position during drag drop operation



I know how to change to a custom cusor or visual instead of a standard cursor during drag and drop operations.  I know how to get the current mouse position during drag and drop methods (often there is a GetPosition method, or alternatively I can use p/invoke or System.Windows.Forms.Cursor.MousePosition getter).

My question is, how can I (or is it not possible) to change the mouse position programmatically during the drag/drop operation, ideally just before the drop occurs so that items are dropped at the point of the programmatically set cursor position? 

I tried to to use the System.Windows.Forms.Position setter and SetCursorPos both in the source's PreviewQueryContinueDrag handler and the target's PreviewDrop handler but neither affected the position of where the items were dropped.  In the case of PreviewQueryContinueDrag, the mouse visually moved to the programmatic location after the items were dropped, even though the PreviewQueryContinueDrag handler was called before the item was dropped (and before PreviewDrop).

Any ideas?



Move cursor position during drag drop operation



I'm enhancing the behaviour of out of the box WF designer drag/drop experience.  One of the things I'm trying to do (in part) is when a toolbox item is drag over an existing activity designer and then dropped, I want the toolbox item's activity to be dropped close to the activity designer on which it was to be dropped, but not directly on top of the designer.

To accomplish this, I detect when a drop operation is about to occur and then I attempt to move the cursor position next to the activity designer.  The problem I'm having is moving the cursor during the drop operation.  I've tried various ways to do this programmatically, but nothing seems to work.  Or, perhaps it is getting moved but then the workflow designer (and in particular the flowchart designer) does something special with mouse position or otherwise ignores it. 

I started out posting this question on the WPF forum, but now I'm beginning to wonder if perhaps there is something unique to  the WF/flowchart designer that's causing the mouse not to move (or to move back to the original position perhaps) rather than a general issue with moving the mouse during drag/drop operations.

Can anyone provide any guidance?



HTMLEditor: Add text to the current cursor position



i am currently using the HTMLEditor and i would like to add a text to the current cursor position in the Editor.

The reason is, i want to add replacement tags when selecting an item from a dropdownlist.


Is that possible at all with the editor component?


I am appreated for any help.


Changing the cursor Position


Hello all,
On Image Click how to move the mousecursor position in web application???

In case of windows application on button_click i have written the following code:

Point p = new Point();
p.X = 41;
p.Y = 400;
Cursor.Position = p;

This works fine & cursors position also change.

but how to do that on aspx page or in web application?????

In my case on Image click i have to move the cursors position.

But I have to move the cursor with clienside script i.e Java Script . How to do that????
Any help
will be appreciated.

Thanks in advance,

Chandrakant Tale.

WorkflowDesigner.Load causes Grid resizing mouse cursor to stop working.


Hi all,

We have a problem where WorklowDesigner.Load() causes the WPF Grid control's resizing mouse cursor not to come up. I have demo app written if anyone wants to double check. http://cid-467e12cdf12776bc.office.live.com/self.aspx/.Public/WpfApplication6.zip


If you just run the demo, you will see the resize cursor will work when you hover over the red grid splitters. However if you go into the wfusercontrol2 control and uncomment this line //wf.Load(new System.Activities.Statements.Flowchart()); , then run the application again you will notice the resize cursor does not show up when hovering over the  grid splitter.


It seems as though under the hood somewhere this exception occurs: Could not load file or assembly 'System.Activities.Presentation.Aero, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

is there any way to know the position of my cursor - in TextBox control ?


i have in my C# (WinForms) program TextBox control

if i have this text in: `abcd efg hijklmnop`

and i stand with my cursor between `c` and `d`  = position 3

or i stand with my cursor between `h` and `i`  = position 10

how to get this position ?

thank's in advance

Set cursor position in TextBox


Im writing Custom control in asp.net

after AutoPostBack , one Textbox of Custom Control always is focused, but cursor position always is in the first position of TextBox

anything idea that make it at the right of the string in Textbox ?

Thanks a lot !

Working with SharePoint document libraries

Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. For example, you can create a library of common documents for a project, and team members can use their Web browsers to find the files, read them, and make comments. Users with Microsoft Office 2003 can check out and edit the files as if they resided on a local or network drive.

By default, your team Web site comes with a built-in document library named Shared Documents, which is listed on the Quick Launch bar as well as on the Documents and Lists page.

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

Cursor Functions

A cursor allows looping through a record set and performing a certain operation on each record within the set. SQL Server supports three functions that can help you while working with cursors: @@FETCH_STATUS, @@CURSOR_ROWS and CURSOR_STATUS. Cursor functions are non-deterministic.


Defines the attributes of a Transact-SQL server cursor, such as its scrolling behavior and the query used to build the result set on which the cursor operates. DECLARE CURSOR accepts both a syntax based on the ISO standard and a syntax using a set of Transact-SQL extensions.

Server side validation of Fileupload control not working



I've tried this method in my code behind to try and validate that the Fileupload control has a file or not. I get the error message the the event "Server Validate" cannot be found. Can anyone tell why? Thanks.

Public Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

' Get file name

        Dim uploadAvatar As FileUpload = DirectCast(AdvertisementForm.FindControl("uploadAvatar"), FileUpload)

        Dim UploadFileName As String = uploadAvatar.PostedFile.FileName

        If UploadFileName = "" Then
            ' There is no file selected
            args.IsValid = False
            Dim Extension As String = UploadFileName.Substring(UploadFileName.L

Row command working on all rows not selected one?



I have this code that hides a column in a gridview.  (The column houses another nested gridview).

    Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
        If e.CommandName = "Select" Then
            If GridView1.Columns(0).Visible = False Then
                GridView1.Columns(0).Visible = True
                GridView1.Columns(0).Visible = False
            End If
        End If
    End Sub

The trouble is that if I click the select link on one row that action to hide is carried out on all rows.  How can I set this up so that it only hides the row that is selected?


upload file not working



iam using masterpage and ajax update panel, i have child page called  fileupload.aspx,i try to upload the file

but its not working , can i use updatepanel in child page , pls very urgent

looking forward for answer.

JQuery Treeview plugin is not working with Ajax page load in ie8


Hi there,

I developed a page where i m using jquery treeview plugin to generate tree. It worked fine on FF, IE8 with out ajax.

But when my page loads thro' ajax call in IE8, it is not collapsing or expanding tree.

Any idea?

Thanks in advance.

How to position one control relative to another one even after resizing windows?


I used following Jquery code trying to make image close to a table. It worked fine after first load, but the position changed after window is resized. Any ideas? thanks

$(document).ready(function() {
            var pos = $("#mytable").offset();
            var width = $("#mytable").width();
            var left = pos.left + width + 20;
            var top = pos.top + 200;
                position: 'absolute',
                zIndex: 5000,
                left: left,
                top: top

jquery confirm windows isn't working


Hi, i am using jquery to implement a modal confirm windows but it not working

i have a template field button with ajax confirm using jquery but i have a problem. Apper the confirm windows but when i click on "yes" doesn't execute the delete command. without ajax (using template field button and simple confirm windows javascript) works so well.

Can you give me a hand with this?

thx in advance!

<link href="_assets/css/StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="_assets/css/confirm.css" rel="stylesheet" type="text/css" />
<script src="_assets/js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="_assets/js/jquery.simplemodal-1.1.1.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() {
       $(".deleteCustomer").click(function(ev) {
                var msg = $(this).attr("title");
                confirm(msg + "?");
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend