|
Im trying to mess with your mind, no just kidding;P
I'm using a propertygrid to monitor a class Properties, but some properties should be able to be settable when the class is in a certain state. This is OK code wise , but like I said the Property is still "settable" according to the user (the brainless user that is), but as soon as he tries to enter a new value it will just revert to the current value, but I dont want to even allow this. I want a nice greyed out GridItem.
It doesnt really bother me, but I have allways taken the approach of Programming for the Dummies , iow what they cant click or change, they cant break, dont even generate interest or you will create an instant 10 finger virus.
Anyways, I will look at some of the code from the PropertyGridInternal namespace, it seems my answer mite lie somewhere deep in there.
Thanx
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Hi leppie,
have you found any workaround for this issue? My custom control has a property, which should be en/disabled depending on another property. I hope you've found a solution already
Regards
Thomas
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
I think a type convertor could solve this. But you will have to keep track of some static members.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
This is the code of an XML Web Service that Query an SQL Server.
It takes two strings and returns a DataSet.
It's a simple excercise, It query the database, populate a DataSet, modify a Field and Update the changes.
[WebMethod]
public DataSet GetUserData(string szUsername, string szNewLocalName)
{
string szSqlCommand = "SELECT * FROM Locals WHERE Username = '" + szUsername + "'";
SqlConnection myConnection = new SqlConnection(" User ID=sa;Password=password;Initial Catalog=laphijia;Data Source=(local)");
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(szSqlCommand, myConnection);
DataSet myDataSet = new DataSet();
mySqlDataAdapter.UpdateCommand = new SqlCommand("UPDATE Locals SET LocalName = @LocalName" +
"WHERE Username = @Username", myConnection);
mySqlDataAdapter.UpdateCommand.Parameters.Add("@LocalName", SqlDbType.NVarChar, 25, "LocalName");
SqlParameter workParam = mySqlDataAdapter.UpdateCommand.Parameters.Add("@Username", SqlDbType.NVarChar, 25);
workParam.SourceColumn = "Username";
workParam.SourceVersion = DataRowVersion.Original;
mySqlDataAdapter.Fill(myDataSet, "Locals");
myDataSet.Tables["Locals"].Rows[0]["LocalName"]= szNewLocalName;
mySqlDataAdapter.Update(myDataSet, "Locals");
return myDataSet;
}
I made this with help from the MSDN NET Framework Developer's Guide article Updating the Database with a DataAdapter and the DataSet.
When I try to access the Web Service and Invokes it, I get a 505 Internal Server Error.
I tried to remove the line:
mySqlDataAdapter.Update(myDataSet, "Locals");
and it works (it returns the DataSet as XML data, but obviously don't update the DataBase.
What's wrong with my code?
I also tried with the SQL Command Builder, but it's just the same.
Thank You.
"Nelle cose del mondo non e' il sapere ma il volere che puo'."
|
|
|
|
|
Try wrapping the Update code with a try/catch and see if something is happening there.
Maybe Alex sees something wrong with the call
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
I tried changing the UpdateCommand with a custom string like "UPDATE locals SET LocalName = 'New Name' WHERE Username = 'john'"
This Worked, I mean, the Method returned the DataSet, and didn't give a 500 Internal Server Error, anyway the Method was completely USELESS now.
But I figured out that the problem is in the UpdateCommand Sql statement.
What's wrong there?
Username is not the Primary Key, it's only used for Authentication purposes on the final version.
How Can I have a correct Sql Statement, connected with the values that I could modify in the DataSet?
"Nelle cose del mondo non e' il sapere ma il volere che puo'."
|
|
|
|
|
The only thing I can see that might be wrong with the SQL Query is that there is no space between the @LocalName parameter and the word WHERE.
If you wrap the dataadapter.update method call with a try/catch you could output any error that is generated, which should give you an idea of what to look for.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
James T. Johnson wrote:
The only thing I can see that might be wrong with the SQL Query is that there is no space between the @LocalName parameter and the word WHERE.
Could you believe it was just this?
Da*n!
Thank You,
this is the great thing about The Codeproject, that new eyes see subtle errors!
"Nelle cose del mondo non e' il sapere ma il volere che puo'."
|
|
|
|
|
Hi,
How do I create a textbox that doesn't get the focus even when it is clicked upon (other than setting enabled = false)?
Thanks
|
|
|
|
|
Hi,
There are several ways
1. Try using a label instead , seeing that the user wont be able to enter text, or
2. On the MouseDown Event , make it select the control that requires focus, IOW as soon as it gets clicked on, it must deselect itself and select the required control.
Hope this helps
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
To clarify, I am trying to create a textbox which, when the user types in numeric , will display those numbers but they shouldn't be able to directly click and type inside.
So a label won't solve the purpose.
|
|
|
|
|
|
jparsons wrote:
t.CanFocus = false;
That property is read-only . I wish it wasn't. Has cause major headache in the past
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Control.CanFocus is readonly. So I think this will not work.
|
|
|
|
|
I am creating a custom control that inherits the ComboBox class. I would like to use the ISite.DesignMode indicator to determine if the control is being viewed in design mode but the property always comes up false. MSDN documentation says the design mode indicator is stored in the ISite; therefore, if the Component does not have an ISite associated with it, this property is always false. Other things I have read said to assign the atribute to the class to designate which class to apply the ISite implementation but I have not seen any examples that put all the pieces together. Can anyone share with me this method or any other method that would allow me to determine when this custom control based on a combobox is in design mode?
Thanks,
Kyle
|
|
|
|
|
Does anybody know where i can get a trial version of C#?
|
|
|
|
|
The .NET Framework SDK is a free download +- 121MB from microsoft. You can use SharpDevelop as an IDE which is also free available
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Or you can order the trial version from this site:
http://msdn.microsoft.com/vstudio/productinfo/trial.asp
Have fun.
|
|
|
|
|
how can i clear screen in console applications?
|
|
|
|
|
|
thanks jared , i though of that solution but i wanted to know if there is a built function do this job
anyway thanks for replying
|
|
|
|
|
1.I can add an assembly to cache, but I cannot find it in dialog when you click "Add reference", how can I let my assembly to the dialog's .net assembly list?
2.I built two version assembly(v1.0.0.0 and v1.0.0.1) that included the same sn, also added them to cache, now I want to refer the certain version of them in my application, how can I do?
I have tried "Add reference", but I cannot find it because the problem 1, then, I used "Browse" to select a certain version dll(ie: v1.0.0.0) file because of using the namespace of the shared assembly, then I wrote a config file of application:
bindingRedirect oldVersion="1.0.0.0" newVersion="1.0.0.1"
But when I run the program, the application still link to v1.0.0.0.
Any thoughts?
Thank you!
I'm amumu, and you?
|
|
|
|
|
Feng Qin wrote:
1.I can add an assembly to cache, but I cannot find it in dialog when you click "Add reference", how can I let my assembly to the dialog's .net assembly list?
In the registry you will find a key where it lists all the directories it will search for. On my computer this is located at HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\AssemblyFolders . Just follow the pattern there and you'll be able to add your install folder to the list so that your assembly is listed in the "Add Reference" dialog.
If you don't want to modify the registry you can put the assembly in the %WINDIR%\Microsoft.NET\Framework\v1.0.3750\ directory and you should see it in the "Add Reference..." dialog. This is one of the directories that is specified in the registry in the above location.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Thank you, James, but how about 2nd question?
I'm amumu, and you?
|
|
|
|
|
I've never used the binding redirect before so I can't really comment on how to get it working properly.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|