|
|
I got it to copy, my question is that why it still looses format.
Storing Info:
IDataObject d = Clipboard.GetDataObject();
//d.SetData(DataFormats.Rtf, true, richTextBox1.Text);
// d.SetData(DataFormats.Rtf, richTextBox1.Rtf);
Clipboard.SetText(richTextBox1.Text, TextDataFormat.Rtf);
Retriving info:
foreach (Word.Shape bkMark in aDoc.Shapes)
{
if (bkMark.TextFrame.TextRange.Text.Contains("heading"))
{
// bkMark.TextFrame.TextRange.Paste();
bkMark.TextFrame.TextRange.Text = Clipboard.GetText(TextDataFormat.Rtf).ToString();
//Clipboard.GetDataObject().GetData(DataFormats.Text).ToString();
//
//
}
}
|
|
|
|
|
bkMark.TextFrame.TextRange.Text contains plain text by definition, if you want formatted text you'll have to use clipboard pasting.
To have control over what will actually get pasted you'll have to specify that you want RTF. IIRC there's a PasteSpecial (or something similar) where you can tell Word what format to paste.
Regards,
mav
|
|
|
|
|
Hi
I try to use GetPrivateProfileResString to quickly retrive .ini file information but I dont know how to make a declaration....
Does someone know?
busio
|
|
|
|
|
read this article.
http://www.codeproject.com/csharp/cs_ini.asp
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|
|
S Sansanwal wrote:
http://www.codeproject.com/csharp/cs_ini.asp
http://www.codeproject.com/csharp/cs_ini.asp
[^]
This message brought to you by the click-it cops
Best,
Jerry
Contrary to the cliche, genuinely nice guys most often finish first or very near it.--Malcolm Forbes Toasty0.com
|
|
|
|
|
|
Hi,
I have a list view control with Label Edit Style.
When the user presses a key while an item is selected, Editing should start immediately.
I catch the KeyPress notification and enter edit mode, but I also have to set the edit's contents (or send the simulate the key event).
For that, I think I need the Edit control itself. Is this possible?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|
|
Hi,
I am attempting to connect with MSDE for the first time with V# .NET, so this is probably a simply questions but I would appreciate help.
I have downloaded an SQL frontend called Teratrax which seems to be great?
My problem is getting full access to the SQL tables I have created, I have difficulty understanding the difference between: Database users and Server logins?
The command SqlConnection is giving me problems, what is 'dbo' user and whats the password for it, my tables appear to be owned by this user?
Any help would be greatly appreciated!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
Dam.NET wrote:
Database users and Server logins?
A server login is anyone that is permitted to log in to the SQL Server. Each server can host multiple databases, so the Database Users are the users permitted to access a particular database. When a database user is created it must know which login the user is accessing the database with.
To create a login in T-SQL use the command sp_addlogin[^]. And to create a database user use sp_grantdbaccess[^]. These links should give you more information.
Dam.NET wrote:
what is 'dbo' user and whats the password for it
The "dbo" is the DataBase Owner. There is no password for it. The "sa" account (System Administrator) is automatically the dbo, as it any user that has the sysadmin role.
As a general rule all objects (tables, views, stored procedures etc.) in the database should be created by a sysadmin user. Users with the db_owner role are permitted also to create objects but they are owned specifically by that user. At the moment I don't want to overload you will lots of information, suffice to say that is is better to have a sysadmin user create all the database object as it can be a real pain in the neck sorting out the security within a database if you allow joe-user to start creating tables, views, stored procedures etc.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Fantastic, my open command now works, but (sorry!) I am getting the following response from the SQL server?
Here is my code:
SqlConnection sql = new SqlConnection(ConStr);
sql.Open();
string sqlcommand="SELECT * FROM Users;";
SqlCommand mySqlCom=new SqlCommand(sqlcommand,sql);
SqlDataReader sqlreader;
error--> sqlreader=mySqlCom.ExecuteReader();
The error reported is:
SELECT permission denied on object 'Users', database 'brUsers', owner 'dbo'.
I would image these SQL security options could get quiet complex for a medium/large application?
Those links to the Microsoft site are great!!!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
Just noticed something I find odd?
When you select a table you get a list of users names? the one I created is now in Database users and in Server logins but not within this table list?
How many passwords do you need for SQL????
Secure its more like fort knox!!!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
OK, OK, Sorry I have now got the login working but I need help with a command?
I did what you said and I can see how they create login and user accounts, Thanks.
The reason it started working for me was I deleted my simple test data table and recreated is specifing my user account instead of the 'odb' which is the default? how can I add user access to a table that is already created?
Thanks again for all this help, I owe you at least a pint!!!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
Dam.NET wrote:
how can I add user access to a table that is already created?
As you posted this as I was typing my other, longer, reply you should get the answer in there. But just to refresh:
GRANT SELECT ON TableOrViewName TO UserOrGroupName
Dam.NET wrote:
Thanks again for all this help, I owe you at least a pint!!!
Thanks. Cheers!
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Dam.NET wrote:
How many passwords do you need for SQL????
Each login has one password.
Of course, you can also add Windows users and groups which allows Windows to perform the authentication on behalf of SQL Server. All you would need to do then is log in to windows.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
What this means is that the account you used to log into the SQL Server does not have SELECT permission for the table Users.
The easiest way is to GRANT SELECT ON Users TO PUBLIC
This means that anyone who is a user of your database can see what is in the table, but not alter it. For more information see the SQL Server books-online: GRANT[^]
Dam.NET wrote:
I would image these SQL security options could get quiet complex for a medium/large application?
It can get complex. That is one reason I said in another thread that all objects in the database should be owned by the dbo, unless you have a very very compelling reason not to. Here is an example in narrative form:
Jack, a db_owner (can create database object, but is not a dbo), creates a table and populates it with some interesting data.
Bob, who is a sysadmin (and therefor is a dbo) sees that some of the intersteing data would be useful to others and creates a view to allow access to only part of the table. He grants permission to public on the view.
Jill, a regular user, wants to use the view and performs a "SELECT * FROM BobsViewOfJacksTable", but the security fails for some reason.
Jill checks the security settings and she has the right to use the view. She is confused and emails Bob.
Bob pastes the select statement into his query analyser and gets the rows back he expects. But doesn't understand why Jill doesn't get the same result. He calls Jack, who tries out the view and it works for him too. Everyone is very confused, because the view is accessable to public, and no-one has a specific deny access on it. Eventually, after two days of trying to work this out, Bob changes the owner of the table to dbo and everything works.
The reason: Jack has only granted select permission to members of sysadmin and db_owner to his table. Jill is neither. However, if the table is owned by the same user as the view the second security check doesn't take place. Jill has access to the view, the view is owned by the dbo, therefore anything that the view uses that is also owned by dbo does not need a second security check, anything that is owned by some other user needs an additional security check.
Does this make your head hurt? It makes mine hurt.
The way this works means that, if everything is owned by the dbo, you don't have to grant access directly to your tables. Instead you can protect them behind views and stored procedures, which the users do have permission for.
It is generally a good idea that permissions are scripted, so everything can be reset easily. Also, if you are doing that it is a good idea that any changes are reflected in the script and the script is kept in a source control system to that the history of changes can be seen easily.
I hope all this helps.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Collin thanks for all your help today!!!!!!!!!!!!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
Hi,
When creating a "generic" WinForms application, adding the File Open / Save etc. handlers is quite some work (Load, Save, Save As, New, Close, and recent files).
I guess the core could be done by a little clever helper class. But is there already something? Or am I missing something in the framework?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|
|
There's nothing like that in the framework. VS 2005 is comming out with a way for you to add default menus and toolbars during design time. Kinda neat, but really... it's not that bad to do it yourself.
|
|
|
|
|
how to use zedgraph to bind to the database? Help plz.
|
|
|
|
|
hi,
It's is not possible to bind the zedgraph direclty with database. What you need to do is collect your data and populate in an array of type double. This information is upto my level best.
For ultimate information please post your thread in that article where the zedgraph describes.;)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
hi
i am a newbie to c#
I hav a string which contains a function name and i hav some arguments for the fuction.Now how do i apply that fuction to those arguments
for example
i hav a string called func
and func="mywriteline" where mywriteline is a fuction. Now is there a way to apply this function
to the arguments which i hav in some other array
|
|
|
|
|
To accomplish this you'll have to use reflection to find the MethodInfo of the method you want to execute.
I'd suggest you read the documentation on the Type class, there are several overloaded GetMethod() methods that can give you a MethodInfo for a method name.
Once you have the correct MethodInfo you call one of it's Invoke() methods to actually execute the target method.
Arguments for this method are supplied in the form of an object array, if any.
One thing you'll have to keep in mind: You can't just "apply a function", you always need an object to execute one of it's methods (it's a parameter for MethodInfo.Invoke() ).
This code fragment should help:
MyObject obj = new MyObject();
MethodInfo mi = obj.GetType().GetMethod(func);
object[] arguments = new object[] { "arg1", 42 };
object result = mi.Invoke(obj, arguments);
Regards,
mav
|
|
|
|
|
hello iam using win xp os. I want to send a message to the user from my c# application before windows shut down how can i ??? plz help me
|
|
|
|
|
You have to register an event handler for the SessionEnding event of Microsoft.Win32.SystemEvents .
Then you'll get a notification when Windows is being shut down and you can pop up a message and cancel the shutdown process or do whatever you need.
Regards,
mav
|
|
|
|