|
Look at your project properties to see what the pre-build event is (if you don't already know). Whatever it is (batch file, script, etc.) you can try running it separately, from a command prompt and proceed to debug it. The article refered to by spif2001 has a batch file, for example.
Additionally, if the script has any error output, you should be able to see it in Visual Studio's "output" window.
By the way, I think you get that message whenever the specified script returns a non-zero errorlevel.
Matt Gerrans
|
|
|
|
|
How can you do this for other browsers like Netscape or Opera? Can this be done for other browsers?
http://www.codeproject.com/useritems/iemozilla.asp[^]
If it has been done can you tell where I can learn more about this or other good resource sites.
Thanks,
|
|
|
|
|
Here is my situation. I have a treeview where the user chooses the type of object they want to create. Next I need to create an instance of that class on my window. Then I need to manipulate the functions and attributes of that class with the window interface. For some dumb reason I thouht that I could force a class onto an object variable. I create an object of type subclass then place it in a variable of type object. The problem is that this requies casting the value from a switch statment anytime I want to access any attributes or functions. I have been looking at this all day and am going cross eyed. Someone please slap me and give me the answer that is probably right in front of my face. How can I take a variable of type object that I know contains some form of subclassed object and create an instance of that subclassed object.
|
|
|
|
|
I'm not sure I understood your problem correctly, but you could assign the object variable to a temporary variable of the proper type, e.g., assume your class is named "MyClass", and your object variable is named "obj":
MyClass x = (MyClass)obj;
Then, instead of using (MyClass)obj all over, you can use x.
HTH.
Yes, even I am blogging now!
|
|
|
|
|
That is what I thought I could do. The problem is what type is MyClass. The obj variable could hold one of 10 different sub classes. Which sub class do I declare x as? This is why I kept talking about the switch statment. I would have to have a switch statment in every function that declared a local var of the appropriate type. I want to create a class level variable that is strongly typed to the sub class stored in obj. Sorry about the bad grammer and explanation in my first posting I was burned out at that point. I am starting to look into using a factory to return the appropriate type but do not fully understand if that fixes my problem because I still have to know what the return type from the factory would be. I feel like I am in an endless loop!
|
|
|
|
|
This is a simple OO problem.
What you need is a base class (preferably an Interface) which defines all the shared functionality of your common objects, that is what you declare the "MyClass" as in the above example.
eg:
interface IDoSomething
{
void DoSomething();
}
interface IDoSomethingFactory
{
IDoSomething CreateDoSomething();
}
public class ConcreteDoSomething : IDoSomething
{
public void DoSomething(){Console.WriteLine("Done");}
}
public class ConcreteDoSomethingFactory : IDoSomethingFactory
{
public IDoSomething CreateDoSomething()
{
return new ConcreteDoSomething();
}
}
function DoFunkyStuff(IDoSomethingFactory factory)
{
IDoSomething myObj = factory.CreateDoSomething();
myObj.DoSomething();
}
|
|
|
|
|
But then my variable is typed to the base class or interface. I then have to write logic all over my app to account for the differing functionality within each sub class. I may be asking a stupid question with this one I was just hoping that there was an easier way. What you suggest is actually how I started except I used abstract and virtual methods in my ancestor class. I just felt like there should be an easier way. I started to look at taking my object and using GetType and then using Reflection to emit a new class of that type but did not pursue it very far. Has anyone else tried something like this?
|
|
|
|
|
Where are my manners? I have forgotten to thank everyone for the responses. It has been awsome being able to get feedback and bounce ideas off you guys. Thank you very much.
|
|
|
|
|
Jim,
You may want to post some simple examples of what you are trying to do, as its hard to give ideas with nothing to go on.
Im 99% sure whatever your problem is can be solved with a decent object model, but I cant be too specific without knowing whhat exactly you're trying to achieve.
|
|
|
|
|
Could somebody kindly give me the code for setting the data to the clipboard for the location point of a control and then retrieving it from the clipboard? The code for the control would be done using ((Control)sender).Location as the data point and it would contain the X parameter (ie X=100 for example) and the Y parameter for the point (ie Y=100 for example). Thus the whole amount that should be written to the clipboard is {X=100, Y=100} which is stored there as a System.Windows.Forms.DataObject. What is the code to write the location of the control using ((Control)sender).Location and retrieving it in another event handler?
New_Phoenix
|
|
|
|
|
The following code example will show you how to use the Clipboard class and place values into and out of it.
private void button1_Click(object sender, System.EventArgs e)
{
Point pt = new Point(100, 100);
Clipboard.SetDataObject(pt, true);
}
private void button2_Click(object sender, System.EventArgs e)
{
IDataObject obj = Clipboard.GetDataObject();
if(obj.GetDataPresent(typeof(Point)))
{
Point pt = (Point)obj.GetData(typeof(Point));
MessageBox.Show(string.Format("X:{0} Y:{1}",
pt.X.ToString(), pt.Y.ToString()));
}
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
Nick Parker:
I just wanted to thank you. Your code worked great.
I do have two more questions to ask, though. Is it possible to create two clipboard objects with chains of data, one to contain the one set of points and the second to contain a second set of points? I would also then need to be able to add to and remove from those chains and thereby move the next element up the chain in the clipboard.
Second, how could I go about parenting one control to another control? For example, I have one control, and I would like to be able to join two controls together so that they could move together. I know that it would be something involving: ctrl.Controls.Contains(control). That is, I would need at some point to ask the control:
if (ctrl.HasChildren)
{
}
How do I join one control to another control so that I could later check to see if it has any children or whether it is a parent of other controls?
Thanks again ! ! !
|
|
|
|
|
Nick:
Here is some sample representation of the code that I need your assistance with regards to control parenting. The controls that are created programmatically default to a parent of the form's name. I would like to set the parent to control number 3 to control numebr 1.
<br />
for (i = 1; i < 3; i++)<br />
{<br />
Control ctrl = new Control()<br />
<br />
ctrlHold = PositionControl(ctrlName, i, loc_x ....) <br />
<br />
<br />
:confused::confused::confused:<br />
if (i == 3)<br />
{<br />
ctrl.Controls.Add(ctrl ??????? how would it know control 2 ???)<br />
}<br />
}<br />
|
|
|
|
|
Hi.
Somebody know how to obtain serial number of devices (video cards, motherboard, hard disk, network card, floppy, sound card, processor etc).
Please I need this information
I tried using WMI, but only I got serial number of hard disk
thanks.
Gussano
|
|
|
|
|
WMI will only work if the manufacturer of the device supplys a WMI provider that will supply this information. Most of the time, the manufacturers DON'T supply this information.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave.
Thanks for your information.
But now the question is:
How to get the serial number (or better all manufacturer information) of a device?
Best regards.
Gussano
|
|
|
|
|
About the only things your going to get a serial number off of are the system (motherboard) and the hard drives. Manufacturers of video cards, CD drives, controllers and other peripherals usually don't supply this information in any way, shape, or form. There is no one Win32 API function that will return this information either.
If you use CIMStudio to search around WMI, you'll find that if you try to get the Manufacturer field off of, say, a CD drive, you'll get back "(Standard CD-ROM drives)". There is no SerialNumber field.
If you look for the VideoController, you'll find that there is no Manufacturer field, nor a SerialNumber field. The Manufacturer is listed under the AdapterCompatibility field. Doesn't make much sense, does it?
In short, you're looking to get information that is not supplied anywhere...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a windows form with a datagrid on it. When the user clicks a button 'Retrieve', it populates the datagrid with the appropriate data. A couple of the columns in this datagrid contain comboboxes in them.
I am using a class similar to the one in the article "DataGrid Zen Novice" to implement my comboboxes.
The problem I'm having is trying to figure out how to populate the values of one combobox, when a new item is chosen from another box. This has to be done for individual rows in the datagrid.
For example:
In my datagrid there is a column for item numbers, and a column for warehouses. If a new item number is chosen from the combobox in row three of the datagrid, the warehouses combobox in row three needs to be re-populated with the appropriate warehouses for this item.
Any ideas on the best way to do this?
Thanks in advance!
nadandjade
|
|
|
|
|
If I have a single WebBrowser control (either the managed wrapper in 2.0 or the ActiveX instance), is there anyway I can force it to draw to the screen multiple times without creating multiple instances of the control? Basically what I want to do is:
-------------------
<draw some html in here>
-------------------
<draw other html here>
-------------------
and so on. I know I can do this with the RichTextBox via P/Invoke (MSDN article on that here[^]), but that same P/Invoke trick doesn't seem to work on the WebBrowser control.
Any remotely useful information on my blog will be removed immediately. There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango
|
|
|
|
|
|
Hi everybody,
it seems to be so simple but ...
I want to store the contents of a multiline textbox into SQL-Server or MSDE.
Using the ntext or text field of the databases does not show the expected results.
The Database truncates all text comming from multiline textbox after a space or CRLF charakter.
The DataSet in memory stores the correct contents but the Database itself truncates the rest.
Is it because the multiline textfield is an array of string[] ?
do I have to iterate over the string field ?
Why does the DataSet does it right but the Database not ?
Thanks in advance
fracalifa
|
|
|
|
|
That depends on how your sending the information to the database. Are you using a parameterized query? What does your code that sends the info to the database look like? On top of that, you must store a single string, not an array of them.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That' the code I am using for
private void data_update()
{
SqlDataAdapter adapter = new SqlDataAdapter();
string upd_CommandString = "UPDATE database_name SET textboxA=@textboxA WHERE id = " + id.ToString();
SqlCommand updateCommand = new SqlCommand();
updateCommand.CommandText = upd_CommandString;
updateCommand.Connection = conn;
adapter.UpdateCommand = updateCommand;
updateCommand.Parameters.Add(new SqlParameter("@textboxA", SqlDbType.NText,16,"textboxA"));
DRow.BeginEdit();
...
...
DRow["textboxA"]= this.txt_Multiline_Textbox.Text; // assign the multiline TB to DataRow object
...
...
DRow.EndEdit();
DB.open(ref conn); // connect Database
adapter.Update(Ds,"database_name");
DB.close(); // close Database
}
// The Database query simply looks like --> SELECT * FROM database_name WHERE id = 123
Whithin the Ds everything is fine, but not in the database field.
Using the database fieldtype NVarChar,4000 instead - everything looks fine -
Where is the fault ?
Thanks
fracalifa
|
|
|
|
|
The problem appears to be this line:
updateCommand.Parameters.Add(new SqlParameter("@textboxA", SqlDbType.NText,16,"textboxA"));
Your telling it that the parameter is a SQL NText field that is 16 bytes long. The type and size value you give it must match the definitions in your database table. If not, you run into screwy problems like this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello All,
I have a form that has 4 textboxes on it and a button. Initially the button is disabled but as soon as someone types/changes text in one of the text boxes I would like to enable the button. How can I detect changes in a text box ? Do I need to watch out for changes in each individual textbox or is it possible for the form to notify me that one of the textboxes changed ? Thanks in advance...
-Peter
|
|
|
|