|
If you are the application, and the application is both the main and child window, why do you have to send data from one to the other?
|
|
|
|
|
|
Does anyone know how in the world does it work in VS2005 to access/write/delete from an MSAccess DB. I can't seem to get it working. I have the connection and the following code:
public void newClientInfo(string firstName, string lastName, string midName,
string phoneNumber, string address, string city, string state, string zipCode)
{
OleDbCommand cmdStore = new OleDbCommand();
cmdStore.CommandText = "INSERT INTO `ClientInfo` (`First Name`, `Last Name`, `Middle Name`, `Home Phone`, `Address`, `City`, `State/Province`, `ZIP/Postal Code`) VALUES "+
"('"+firstName+"','"+lastName+"','"+midName+"','"+phoneNumber+"','"+address+
"','"+city+"','"+state+"','"+zipCode+"')";
cmdStore.Connection = conObj;
try
{
conObj.Open();
cmdStore.ExecuteNonQuery();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Problems: " + ex.Message);
}
finally
{
conObj.Close();
}
}
It seems to be working fine, but for some reason, it does not appear on my DB file. Can anyone lend me a hand?
Thank you.
The Slowest component sits at the keyboard.
|
|
|
|
|
Have you verified that the code is executed at all?
How do you check if the database has changed or not?
---
single minded; short sighted; long gone;
|
|
|
|
|
Yes, I have checked that the code executes with the help of F10. I also check the access file, but there are no changes, all fields on the table say
NULL
The slowest component sits at the keyboard.
|
|
|
|
|
Well, if the code is executed then you have added a record somewhere. Are you sure that you check the correct database and the correct table?
---
single minded; short sighted; long gone;
|
|
|
|
|
ExecuteNonQuery returns an integer that represents the number of rows affected (inserted in this case). Add a variable to get that value and see what it says.
The one thing I noticed in your query was that there were apostrophes or single quotes around the table name. I don't think you should have those there. One other point is that you should use parameters in your command instead of concatenating them.
|
|
|
|
|
ExecuteNonQuery gives me the value of 1. Now about the single quotes, I tried taking them out, and it gives me a query error.
Now here is one interesting thing i've noticed. Everytime I run the program, I notice when going back into VS, the connection to the database kinda closes on the server explorer. Anyone know what could possibly be done to prevent that from happening?
The slowest component sits at the keyboard.
|
|
|
|
|
Try using square brackets [] around the table name and everywhere else you have the single quotes except in the Values section.
The value of 1 means it updated something.
|
|
|
|
|
Nope, nothing at all, does the same thing.
The slowest component sits at the keyboard.
|
|
|
|
|
I'm rephrasing this question because its original form was never answered.
I'm trying to define structs and/or controls as properties. Types are declared with the Serializable attribute, and property declarations are marked as Browsable. Both get and set accessors are provided, and runtime code has no problem addressing the properties. The root class descends from Control.
The expected and necessary design time behavior is that Properties view displays these properties under expandable nodes, with the properties/fields of each displayed within the node.
Instead, the property is displayed in gray/disabled text, and there is no expandable node.
What else do we have to do, or what might we have done wrong, which denies us this intended behavior?
TIA,
m
|
|
|
|
|
You need to define or create a ControlDesigner and assign it to the class using the DesignerAttribute .
|
|
|
|
|
Thanks to you.
Since we've tried that, I assume there must be something wrong with our designer, and that we need to revisit the documentation on that.
m
|
|
|
|
|
Documentation certainly doesn't seem to support your suggestion:
The ControlDesigner class provides a base control designer class that can be inherited from and extended to provide design-time support for a Web server control in a design host, such as Visual Studio 2005.
|
|
|
|
|
Moreover, DesignerAttribute cannot be applied to structs. (So says Visual Studio.)
|
|
|
|
|
Thanks to the following CodeProject article, this issue is now solved:
http://www.codeproject.com/csharp/propertyeditor.asp
What we need for the intended expandable property node behavior is a *TypeConverter*.
This article was excellent, in that it got straight to the point and didn't fail to raise any important detail. Everything worked as intended, first try.
Much thanks to Kodanda Pani.
|
|
|
|
|
If anyone is interested (I assume many of us have to deal with this issue), I have discovered that implementing TypeConverter is very sensitive to DefaultAttribute declarations. I'm getting nested nodes without default attributes, but they are dysfunctional. I discovered this in design-time testing, wanting to eliminate the possibility of invoking Reset on the composite property, because the IDE would raise errors whenever we did this. I next thought that since I had declared default attributes on the underlying property classes, that I may as well not declare default attributes on properties of these types... but no... the TypeConverter implementation falls apart then.
|
|
|
|
|
I dropped a PropertyGrid control on a tabpage to use for user settings. I then connected the control to a new class using the propertygrid's SelectedObject property. All of my properties show up fine but I need to know how to capture the event when a property is changed and store it.
Originally I used a settings file but was unable to customize (especially the help descriptions) it to my needs. Hence the new class.
Thanks,
Mark
|
|
|
|
|
The PropertyGrid should automatically update your class after its been bound using SelectedObject.
|
|
|
|
|
I want to paint a particular part of image on the form that is I want to display the picture not its background... I have differentiated between both the background and picture using lock mode and bitmap data. Now how can I display that required portion on the form??? Can any buddy help?????
should I use region if soo then how???????
-- modified at 3:42 Wednesday 21st February, 2007
|
|
|
|
|
The desktop is not intended to support such functionality.
|
|
|
|
|
mike montagne wrote: desktop is not intended
I dont want it on the desktop I want it on the form......
|
|
|
|
|
So reference GDI graphics and/or read articles on this site for your answer. If you have the image, you can assign it to your form's background image. If you need to take a subregion of the source image, clone, copy, or draw that to a new bitmap, and assign that to your background image.
|
|
|
|
|
hi all,
i wanna to ask,
that if i have a line and i want to select it
how can i make it seems to be selected(u know in graphics
shapes have their color changed or selected when clicked)
Generator
|
|
|
|
|
The most simple method is to XOR the color. Off the top of my head I do not know the method to XOR a color. Also you can draw a border around the line. Or you can change the pen to be dashed or some other non-solid pen type.
Pen pen = new Pen(new System.Drawing.Drawing2D.HatchBrush(System.Drawing.Drawing2D.HatchStyle.Cross, Color.Black), 2f);
File Not Found
|
|
|
|