|
It looks like you're trying to assign a string value to the sheet object, rather than the property which contains the name. I've not done any interop in a while so I can't remember the syntax - something like:
wbk.Worksheets["Sheet1"].Name = "Mvelo";
should work about right.
HTH
Dave
It definitely isn't definatley
|
|
|
|
|
This is the error I get when I put the '.Name' code:
wbk.WorkSheets["Sheet1"].Name = "Mvelo";
'Only assignment, call, increment, decrement, and new object expressions can be used as a statement.'
Mvelo Walaza
Developer
Telkom SA
modified on Tuesday, April 22, 2008 2:15 AM
|
|
|
|
|
hi
i have to read selected items of one list box to other listbox.and the selected item should be deleted and added to other list box.its working i had done it.
but the problem is it should not hit the server while doing such process.so we have to do the coding in javascript itseems.so plz help me in this regard.pls provide me the code in javascript.
iam clear with my question?
|
|
|
|
|
Why would you ask for javascript in the C# forum ?
I suggest reading the article I link to in my sig.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
HI, i ve written an application in dotnet c#(visual studio 2005) which requires to call a function written in c(this is part of other application). So please help me on how to call this function.
|
|
|
|
|
your C function can be called as part of a dll using P/invoke. You have an app in C, not C++ ? It works the same way, anyhow, so long as it's in a dll. To call the function within a running app, you need to use WM_COPYDATA or something to set up interprocess communication.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi, now i ve been able to call the function from the c# application. I made the dll and in the *.def file i ve exported this particular function. Then in my c# application using [dllimport(*.dll}], i called the function and i was successful in that, Now according to the c application as soon as this function is called it populates a structure with some values and ultimately i want these values. So now after successfully calling this function how can i get the structure values????Pls help
|
|
|
|
|
hi,
by trial and error method i have added many users to the DCOM object through DCOMCNFG. I want to know while hosting the website which users would require the permissions. and also keep everything secured.
thanks,
adi_nik
|
|
|
|
|
i think you only need to add ASPNET user
|
|
|
|
|
|
Hi!
I'm developing a Winform application in C# 2.0 which access to a SQL Server Express.
Currently I'm using this connection string (app.config):
connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=True"
As you can see, currently I'm using Windows Authentication to log on the SQL Server.
I want to add a user login form and depending on which user has logged in, I will grant or deny opening some of the forms which my application has.
How should I manage these users? I was thinking in having a table with (user,password) and encrypting the password in some way.
Is there a best practice to do this?
|
|
|
|
|
User Management can be done in two ways: using LDAP (Lightweight Directory Access Protocol), will allow only thos users to log on to the application who are a part of that windows domain. This approach might be a little cumbersome as many applications do not require such tight coupling with windows domain for allowing or denying access to users, moreover, it is certainly a tedious task to use LDAP to manage access to individual forms. The other way out, is your way, creating a table for users and storing their passwords in encrypted form, now here, I suggest to create an admin table as well that will reference to the user table on the basis of unique user id, and since you plan to grant or revoke permission on users, yourself, you can also create an admin screen in your app, wherein you can enlist all users and their information and you can grant/revoke permissions there and these details will be updated in the admin table. For the encryption part of it, u can write a simple substitution cipher program that will shift the bits to either one left or one right to give you an encrypted string, or, u can use the Encryption class of the .NET F/W, I personally prefer to write my own program for encryption, as it is great fun to experiment with n-number of ways of encrypting data. Let me know if i was able to give u some headway...
cheers
|
|
|
|
|
Ok, thanks.
I was thinking in creating two tables: (Users table and ModuleAccess table)
(User,Password)
and
(User,Module)
User is the primary key for the first table.
User+Module is the primary key for the second table.
The password column actually will save the "user+password" string encrypted. I mean, there will be a LogIn form where you must enter your user and password, after that, I will encrypt the user+password string entered in the LogIn form and compare it with the one I've saved in the table.
I will use a similiar aproach to handle the modules (forms that the user can access).
Thanks!
|
|
|
|
|
i think you should define some roles and add your users in that roles...
and on form level check which role has access to which forms
|
|
|
|
|
Hi all.
The attached code works absolutely fine. However if I want to send the "encryptedString" over a socket I receive the following exception where the send fails:
"Exception: Found a high surrogate char without a following low surrogate at index: 8. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.
Parameter name: chars"
However, this does work over the socket in about 1 in 10 times. I have also tried to send as bytes instead of string which solved the socket problem but corrupting the data so it couldn't be decrypted using the private key after transfer.
I am using .net 1.1
Does anyone know the solution to this problem?
Thanks, Anthony
// Represents UserA generating an rsa key pair
UnicodeEncoding byteConverter1 = new UnicodeEncoding();
RSACryptoServiceProvider rsa1 = new RSACryptoServiceProvider();
string publicKey = rsa1.ToXmlString(false);
// Represents UserB encrypting a message ("hello world") with UserA's public key
RSACryptoServiceProvider rsa2 = new RSACryptoServiceProvider();
rsa2.FromXmlString(publicKey);
UnicodeEncoding byteConverter2 = new UnicodeEncoding();
byte[] bytesToEncrypt = byteConverter2.GetBytes("hello world!");
byte[] encryptedBytes = rsa2.Encrypt(bytesToEncrypt,false);
string encryptedString = byteConverter2.GetString(encryptedBytes);
// Represents UserA decrypting the message with his private key
byte[] bytesToDecrypt = byteConverter1.GetBytes(encryptedString);
byte[] decryptedBytes = rsa1.Decrypt(bytesToDecrypt, false);
string message = byteConverter1.GetString(decryptedBytes);
string msg = message;
|
|
|
|
|
Hi People,
I have a ToolStrip with some items.
When I hit some button I load a form inside a Panel and disable some of the ToolStrip menuitems.
So far so good.
Now I want to enable those menu items when I click a button on the usercontrol that was loaded in the panel control...
How do I achieve this??
btw: Im a newbie and search google, but cannot find anything :-S
TIA,
Richard
|
|
|
|
|
There's a good article here on CP about cross form communication. Short version - you define a delegate to get a method call in one form, to call a method in another. If you google delegates, you'll find tons of examples.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Thanx Cristian and cocoonwls,
I did allot of reading regarding delegates but boy o boy what a information that is
As you could probably have guessed , Im a beginner in the world of C# (If have allot of VBA experience though but this is something else)
I'll try to explain what Im trying to achieve;
I have a form (MainForm).
On MainForm there is a button that loads another form (Form2) (inside a panel, dont know if that is rellevant) and disables some menuitems using "this.relatiebeheerToolStripMenuItem.Enabled = false;"
Know.. on the Form2 I need to have a button that closes the form (Form2) and sets the menu to enabled again..
There is allot of info on delegates but I can't find anything matching my ' problem'
Please help
Richard
*edit* : I made a mistake.
Actually there is one form (MainForm) and the ' form' im loading in the panel is actually a user control.
Dont know if thats makes a difference ..
modified on Monday, April 21, 2008 6:19 AM
|
|
|
|
|
Hi Richard,
There are the same(load form into panel ro show as dialog).Below is the example by using delegate;
FormMain:
public FormMain()
{
Form2 f2 = new Form2();
f2.TopLevel = false;
f2.visible = true;
this.panel1.controls.add(f2);
f2.callbackFn += new hidetoolstrip(this.abc)
}
private void abc(boolean b)
{
}
Form2:
public hidetoolstrip callbackFn;
private void button1_Click(object sender, EventArgs e)
{
callbackFn(True);
}
Class Delegate:
public delegate void hidetoolstrip(boolean b);
Above example is what the article wrote.Hope this help you
|
|
|
|
|
Hi all,
I want to create a custom combo box control which has some extra buttons. Whilst I can render the various parts of the control using "ComboBoxRenderer", the controls do not match the other Vista combo boxes. This makes any form using such comboboxes look strange because there are two flavours.
The proper Vista ComboBox controls are a rounded edged rectangle with a black down arrow (white background). When you hover the mouse over the arrow the button appears. The "ComboBoxRenderer" shows a non-highlighted button with a black down arrow on it.
How can I draw the proper Vista style combo box themed visuals AND still have it compatible with Windows XP? It would be great if someone could offer an example.
Cheers!
Lea Hayes
|
|
|
|
|
i have the same question , and don't know how to solve it,
i googled it and found here
Have you fixed it yet ?
regards
badtoto
|
|
|
|
|
Hi,
I am afraid that I was unable to find a solution to this problem. So I resorted to just having two styles of combo box in my program, doesn't look as good as it could have, but nevertheless, functional.
If you do manage to find a fix, it would be great if you could post it here as this is something that I too am still interested in.
Many thanks,
Lea Hayes
|
|
|
|
|
Hello!!
I have been googling to find a way to add an image in an rtf document, and all I've found up to now is by converting the image in a hexadecimal string... and I realy can't understant anything...
Does any one know if there is a simplier way for this, something like we use in old good html like img src and filepath?
Thanks!!!
|
|
|
|
|
Hi!
Probably the easiest way is to put the image into the clipboard and then paste into your RTB.
You won't have a lot control over how the image is being displayed, but it's very simple.
Another way is to use the corresponding OLE functions. There's an article here on CP somewhere...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|