I have a richTextbox and in it I just need to display some formatted text. But I don't want the user to edit it. I've set the richtextBox property to readOnly and Ok, it doesn't allow the user to enter any text. But the blinking cursor still appears in the richTextBox. Is it possible to remove that too?
I need to have a RichTextBox that displays various text (in color), but the user cannot highlight or edit the text in anyway, With a regular textbox, I can set .Enabled=False and that does exactly what I want, but with the RichTextBox, setting .Enabled=False turns the box grey, and I need it to stay on the BackGround color....labels won't do, as I need individual words to be different colors.
I'm trying to create a custom control based on TreeView, to be used in other programs.
The control should read the disc folder structure and display it.
The control builds OK, finds the data and builds the tree items.
Trouble is, in the host program, nothing is visible.
Any help will be appreciated.
Since you have not given us any information about the problem, that is going top be difficult. Remember, we cannot see your screen or source code. You need to do some debugging and provide some actual details of what is happening in your code.
To add to what jibesh said - please don't do it like that! Never store passwords in clear text - it is a major security risk. There is some information on how to do it here: Password Storage: How to do it.[^]
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
i want to detect mouse over on title bar or mouse out from title bar in my c# winform apps. i got a code sample which works but the problem is when i place the mouse on any area of win form then mouse leave occur and when i put mouse on title bar then right event call. actually i want that if i place my mouse on any area of form except title bar then nothing should happen.only when i will place mouse on title bar then a notification should come to me and when i will remove mouse from title to out of my form then label should display mouse out message but if remove mouse from title bar to form body then label should be blank.
here is code. just run this code and tell me what modification i should do to get my expected result. thanks
i have a database called power,i'm trying to save data into it.
after insertion the graph is initialised with new values.So everything seems to work perfectly,But when i restart my application i don't find the new value,it's not saved.
powerdbDataSet db = new powerdbDataSet();
// TODO: This line of code loads data into the 'powerdbDataSet.powertable' table. You can move, or remove it, as needed.
chart1.Series.XValueMember = "time";
chart1.Series.YValueMembers = "power";
chart1.Series.IsVisibleInLegend = false;
powertableBindingSource.DataSource = db.powertable;
I suggest that you are only updating the values in your table adapter but the table adapter does not store the data into the database - the data stays in the memory (table adapter). There must be a method to force the table adapter to update the database - Don't ask me how it is called exactly but you might want to have a look into the corresponding MSDN article[^].
If so, are you copying the balnk database from your project to the bin folder every time you build?? This is usually the case when an Access database is used and is part of the project as a Content file. These files are recopied to the build bin folders every time you recompile the project, thereby overwriting the data your wrote in the last pass.
As Dave said, it is quite possible that your .mdf file is being recopied from your source directory to your bin directory when you rebuild your project. Check the properties of the file in Visual Studio and make sure Copy is not set to "Copy always". You should also check the code where you do the Insert or Update commands.
I know the functionality of Abstract Class & Interface.
But, in which situation i can use this.
Consider I am starting a new project and I need to design and create a class. So here in which situation I should create AbstractClass or Interface. How to find out which is suitable for particular situation.
Please give me some practical situation where I can use and where I can't.
If you need the actual implementation of some functionality to be the same, you would consider an abstract class. If you only need the contract to be the same or you need to do something that looks like multiple inheritance, use interfaces.
I was brought up to respect my elders. I don't respect many people nowadays.
You can't use an interface for the implementation of common functionality, all an interface does is define what is available not how it is actually achieved. Lets take a simple example, modelling a cats which can for simplicity only look around or make a noise the Interface would look like:
OK, lets say I want to model a Tiger and a Cat. Both Implement IFeline, both look around in the same way, but a cat purrs but a Tiger roars. LookAround is common to both and should be in a base class. I don't ever want to create and instance of the base class, so I create an abstract one which encapsulate what is common:
publicabstractclass Feline: IFeline
publicabstract MakeNoise(); //This is needed to stop the compiler complaing
Now I can implement the differing functionality:
publicclass Cat: Feline
publicclass Tiger: Feline
Your code would work, but you have repeated LookAround() method, this increase your maintenance overhead if you needed to change one, the chances are you'd need to change the other. Obviously this is a simple example to try and make the principle clear so it doesn't stand up to close scrutiny. Additionally the abstract class adds a semantic meaning : these are all the things that my subclasses can do that are common to all of them.