|
Hi,
You could do that with the oldest .NET version, you don't need all the fancy stuff, it just complicates simple tasks like this one. Besides, you asking this tells me you are not ready for the fancy stuff anyhow. How about buying a tutorial book on C# and working your way through it?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
First off, I have read this article:
http://msdn.microsoft.com/en-us/library/bb264562.aspx#[^]
And I have created the classes it mentions and I understand how to change the properties and all that. That is the easy part.
My problem is how do I get the installer to trigger this wrapper during the application install process to get SQL Server installed?
I have made many setup packages, but I've never tried to roll the installation of SQL Server itself into the setup package and I'm hitting a major brick wall and just can't get it figured out.
I have my application, let's call it "MainProgram". I then created a secondary application called "SQLInstaller" that consists of the classes outlined in the article, and have built that exe. What I can't figure out is how to make the installer run my "SQLInstaller" during the installation of "MainProgram". I'm sure I'm making this more difficult than it needs to be, but I've just not been able get it, and all google articles seem to merely point back to the original article I've already read.
Any assistance that would clarify the missing pieces would be greatly appreciated.
|
|
|
|
|
I hate to be that guy that bumps his topics, but I'm really hoping someone out there has a sample project or something I can look at to help me figure out where I'm going wrong
|
|
|
|
|
Hi
VS2005 winforms
Is it possible to programatically open a dropdown list?
- similar to a user clicking on the button on the right hand side?
Thanks,
Chas
|
|
|
|
|
if you're talking about the drop down list in a combo box then it's: comboBox1.DroppedDown = true;
|
|
|
|
|
Thats what I was after
Thanks
Chas
|
|
|
|
|
Have a c++ app that may be converted to c#, but I am having a problem with this:
c++ A buffer is read off a socket, and the first byte represents a message id, which cooresponds to a particular typedef:
typedef SAMPLE {
uint16 msg_id;
char status[10];
uint16 value};
and I can simple do this: sample = (SAMPLE)data_buffer_read_of_the_socket
and sample.msg_id, sample.status, and sample.value are filled in nicely.
I cannot seem to find any equivalent way of doing this in C#. Can anyone help?
|
|
|
|
|
You're looking for serialization[^], of the binary kind
--edit--
I know that's it's not the same as casting, but it's easy to do and won't cost that much extra time.
I are troll
|
|
|
|
|
I am having a problem with sorting a multi-column ListBox. For simplicity, let's say I only have 3 columns: Id, Score, and TotalPoints. I have implemented a Compare method from the IComparer interface that looks like this:
public int Compare(object x, object y)
{
int compareResult;
ListViewItem listviewX, listviewY;
listviewX = (ListViewItem)x;
listviewY = (ListViewItem)y;
compareResult = ObjectCompare.Compare(listviewX.SubItems[ColumnToSort].Text, listviewY.SubItems[ColumnToSort].Text);
if (OrderOfSort == SortOrder.Ascending)
{
return compareResult;
}
else if (OrderOfSort == SortOrder.Descending)
{
return (-compareResult);
}
else
{
return 0;
}
}
The sorting is inaccurate though. For example, let's say I have 3 rows, and the Scores are 10, 11, and 2. When I sort the column, it displays 10, 11, then 2...not 11, 10, 2. I am pretty sure it has something to do with the number of digits in the string, but I have no idea how to resolve it. For the most part the sorting works, just this little kink. Any help would be greatly appreciated.
Thanks
|
|
|
|
|
dfb78 wrote: compareResult = ObjectCompare.Compare(listviewX.SubItems[ColumnToSort].Text, listviewY.SubItems[ColumnToSort].Text);
dfb78 wrote: and the Scores are 10, 11, and 2. When I sort the column, it displays 10, 11, then 2...not 11, 10, 2.
You are doing text (ASCII) comparison. You need to change your text to int/long then compare.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Duh! That was it, thank you!
|
|
|
|
|
Hi,
I have several remarks:
1.
if it contains ListViewItems, I guess your Control is a ListView, not a ListBox.
2.
you did not show code for ObjectCompare, which does the actual compare.
3.
all we can see is ObjectCompare takes two strings; if all it does is compare the strings, then the right order is 10, 11, 2 since strings by default get sorted alphabetically based on their individual characters, taken from left to right, hence 11 comes before 2 since '1'<'2'
4.
if OrderOfSort happens to be SortOrder.Unspecified then any result would be correct.
5.
I don't know how you populate your ListView; if you have objects that hold numeric values (such as Id, Score and TotalValue) then it does not make much sense to convert them to string (so you can show them in the ListView) and then try and convert that string back to integers so you can perform a correct compare. You could use the ListViewItem.Tag to hold a reference to your object, and then perform the necessary comparison directly using the integer values.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
hi every body
I want to make profetional calculator for complex operation
such as to calculate this statement A+B(f*g-r)/A+B .. and somthing like that
how can i do that??
|
|
|
|
|
By learning how statements and equations (and something like that) work
Where do you want to start?
I are troll
|
|
|
|
|
thanks
I know many thing about statement and stack and some thing about priorities
and about prefix and postfix ..etc
just I need some helps like idea and some codes
|
|
|
|
|
the exile wrote: [...]and some codes
Boy are you in the wrong place for that.
|
|
|
|
|
the exile wrote: how can i do that??
Do you know we've a wonderful article repository? [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
...but....but....but....those articles do not do this statement A+B(f*g-r)/A+B
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
The articles were just to fool him, why parsing when you may use javascript?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Why parse at all? Just hard-code the expressions
|
|
|
|
|
I'm not much of a programmer, but I'd start by modelling the data items as structs - one element for the real, the other for the imaginary part - then overload the operators to define complex functions.
For instance,
struct Complex
{
public double Re, Im;
public Complex(double Re, double Im)
{
this.Re = Re;
this.Im = Im;
}
public Complex(Complex X)
{
Re = B.Re;
Im = B.Im;
}
public static Complex operator + (Complex A, Complex B)
{
Complex result = new Complex(A);
result.Re += B.Re;
result.Im += B.Im;
}
}
This defines a struct with two parts called Complex, with real and imaginary parts called Re and Im, respectively. Re and Im are declared as type double. Two constructors are declared, one being initialized with separate values, the other by a type Complex value. The last bit overloads the '+' operator to return a Complex sum of two Complex variables. You can add other operators to the mix by writing the code to implement them. Although structs do not have methods, operator overloads (which look just like methods) work on structs as well as classes. In your calculator application I'd define buttons to click for each overloaded operator, something like what Microsoft has done with the built in Windows Calculator utility.
By the way, I didn't write or test the above - I modified an example in a book I'm studying to fit your situation. You might want to pick up a copy and read it; "Professional C# 2005 with .Net 3.0" by Wrox Press. It's quite thorough and very readable.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Here's how I would do this:
1. Make a binary tree. Leaf nodes stand for your variables (A, B, f, g...). Interior nodes stand for an operation on the values of the interior node's two sons.
2. Go through your statement and put all tokens into a list of leaf nodes. (The operations will eventually be transferred to interior nodes.)
3. Find the range of nodes where the parentheses are most deeply nested.
4. If you have the pattern [left parenthesis] [variable] [right parenthesis], delete the two parentheses nodes. (The variable could also be an interior node.)
5. In this deeply-nested region, replace the pattern [variable] [high-precedence-operation] [variable] with an interior node for the operation, with the two variables as sons. (The variables could also be other interior nodes.)
6. Repeat Step 5 for the low-precedence operations. You should now be able to apply Step 4 on the remaining interior node left in the parentheses.
7. To evaluate the expression, do a post-order traversal on the binary tree, getting the variable values for leaf nodes, and applying the operation to the two values for interior nodes. The result of the evaluation will be left in your root node.
I find this approach simpler than the recursive algorithms.
modified on Friday, March 27, 2009 10:10 AM
|
|
|
|
|
How do you use a poplated <list> array to feed into a listbox.
I tried using the datasource property, but it doesn't return what I would've expected. Of course I could manualy do this with lots of code. But is there a quick method.
I tried using the 'items' property, but it says its readonly and blows up.
this.lbNames.DataSource = cn.Patient.Names; // I get the appropriate number of records but... not the actual records I get like the name of what kind it is...lol
-Robert
|
|
|
|
|
Please show some code. What is cn.Patient.Names ?
All you need to do is:
ListBox.DataSource = yourList;
जय हिंद
|
|
|
|
|
cn.Patient.Names is a <list>
and I explained that it did not work, but rather it returned like a the full namespace twice. Indicating that there were 2 records.
private void Patient_Load(object sender, EventArgs e)
{
this.lbNames.DataSource = cn.Patient.Names;
}
there is obviously a lot of code to copy... and some of it I would not want to reveal, but here is the last where Names is declared... Also there are two records by the time it gets to the above place.
Names = new List<theName>();
|
|
|
|
|