|
Hi!
I'm having a problem whit my page. I have a sql db, and I want to combine to columns, "lastname" and "firstname", from my "user" table. I want to put the the combined two colums in one dropdownlist. This is my sql query:
SELECT DISTINCT u.UserID, Firstname, Lastname
FROM [User] u, Course_User cu
WHERE cu.UserID=u.UserID
Does anyone have a suggestion on how i can solve this?
|
|
|
|
|
You could change the query so it returns the combined first and last names.
SELECT DISTINCT u.UserID, Firstname + ' ' + Lastname
FROM [User] u, Course_User cu
WHERE cu.UserID=u.UserID
If I had a better memory I would remember more.
|
|
|
|
|
I was going to suggest the very same thing that Suzanne did as this is a quick work around. I have also used an ArrayList to help display the two db columns of data.
Great article suggested by Heath!
Goals are dreams with dates attached.
|
|
|
|
|
Thanks Suzanne!
It worked great!
|
|
|
|
|
What Suzanne said is a good idea. If you want columnar data, however, take a look at Multi-Column ComboBox[^] here on CP. It should give you some ideas and seems to already be data-bindable.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I'd like to write a simple program that starts by itself when the computers is starting, without user intervention.
How can I do that ?
Thanks
|
|
|
|
|
You can just drop the program in your startup folder if your running windows.
C:\Documents and Settings\user\Start Menu\Programs is a typical location of the startup folder.
|
|
|
|
|
Yes, that's an idea; but it's not what I expected.
In fact, I want to write an underground program, running like an anti-virus or an alarm. Suppose, to make simple, that it is an alarm.
When the computer is turning on, the alarm-program is starting (undergroundly). And each hour, it makes a sound (with no interface).
How can I do that. Must I build a Windows service ?
Thanks
|
|
|
|
|
That would be your best bet. Unless you want to start your program from the Run key in the Registry and set your forms ShowInTaskBar property to false.
RageInTheMachine9532
|
|
|
|
|
bsargos wrote:
undergroundly
I learned me a knew werd to day!
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
It's not funny
I would prefer you answer my question !
|
|
|
|
|
You'll have to create a windows service. If you're using VS.NET you can create a new project by selecting Windows Service to get you started. You'll need to add your code to the OnStart and OnStop methods in the class it creates for you. From the design view of the class right click and select Add Installer. This makes it possible to use installutil.exe to install the service on the target machine. Read about Windows Service Applications[^] for more information.
|
|
|
|
|
Thank you very much
|
|
|
|
|
I've just copied the sample DataGridTimePickerColumn style from the VS help, and used it on a few DateTime columns in a DataGrid (in the constructor, I set it to the short date format). What a mess! You'd have to pay people a lot of money to make them use it!!
Pressing 'Tab' seems to move across the columns as expected, until after you click on one of the columns to give it focus. Then 'Tab' takes you to every other column! Plus if the DateTimePicker is on a form, you can use the up and down arrow keys to scroll the parts of the (short) date. In the DataGrid, all they do is move up and down the columns of the grid.
Has anyone seen an example anywhere showing how to do this properly?
Roj
|
|
|
|
|
The keyword is example. There are several implementations of various DataGridColumnStyle derivates here on CodeProject and on MSDN[^], but you could always read the documentation and create your own.
The arrow keys are intepreted differently because of the control being hosted in the DataGrid . It's not so easy to make these behave as you'd expect for the hosted control - in this case a DateTimePicker .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
hi
i want to know that there is three loops for matrix multipltication for instance
for(i=0;i<3;i++)
{
for (j=0;j<3;j++)
{
for(k=0;k<3;k++)
know if i want to know abt how i should enter the value in an array and what is the function of theird loop how should i input the value in array
3*3d matrix
|
|
|
|
|
If you're declaring a multi-dimensional array (as opposed to a jagged array), then you could do something like this:
double[,,] matrix = new double[3,3,3];
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
for (int k = 0; k < 3; k++)
matrix[i, j, k] = i * j * k; A jagged array wouldn't be a whole lot different, but you'd declare it as double[][][] and reference elements as matrix[i][j][k] . A multi-dimensional array is recommended in this case. You can read more information about the difference by reading about Arrays[^] in the C# Language Specification.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi
i try to send xml bitween client and server win app
but
i want to do that as xml not by encoding it into byte`s
thank you
|
|
|
|
|
You must. All web servers do it, whether download HTML web pages or sending and receiving SOAP messages. You must encode it (whether you do it or some class you use does it, like an HttpWebClientProtocol used for web service proxies or a simple HttpWebRequest ) and use the same encoding on both the client and server.
Once the server decodes it using the correct encoding, you've got your XML back. This is how a network works - you upload/download bytes and text gets encoded in order to be send as bytes. Most often, APIs do this for you, but it still gets done. If you insist on using socket connections and sending data yourself instead of using one of the many helper classes, then you are responsible for encoding and decoding data.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
How can I drawing on axhost control?
I try this code: (AxHost Control is a)
Graphics g = a.CreateGraphics();
Pen p = new Pen(Color.Blue,2);
g.DrawLine(p,0,0,100,100);
but line dont appear. Thanks.
|
|
|
|
|
An AxHost control is just the base class for a hosted ActiveX control. The ActiveX control is responsible for it's own drawing, so using a Graphics object to draw on top of it won't work unless you provide some way through your controls supported interfaces to draw on it. One such way would be to return an HDC (as an IntPtr in managed code) from some method in your ActiveX control that you can use to create a Graphics object (see Graphics.FromHdc ) and then draw on the ActiveX control.
Also, be sure to call Dispose on your Graphics object to free native resources that the Graphics object uses, otherwise your performance will degrade over time.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
good day everyone,
can someone help me figure out how to get a list of all machines on specified network domain?
thanks a lot.
|
|
|
|
|
If you're using Active Directory for your domain, you can use the DirectorySearcher . See the article Querying Active Directory using .NET Classes and LDAP Queries[^] for an example.
If you're not using an Active Directory for your domain but instead are using old-school NT4 domains, then you'll have to query the WINS server. I'm not aware of any examples doing this, but you could find more information about querying a WINS server in the MSDN Library[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
:-Ohay there,
Before getting into any solution please read the entire message. See we have Exception Class in .net framework from (System.Object). Exception class is the base class for all exceptions(this sentence is from msdn).
So you are agreeing with this concept that, Exception is a Class.
just see the eg:
1. int a=10,b=20;
2. try
3. {
4. a=b/a;
5. }
6. catch(Exception Ex)
7. {
8. MessageBox.Show(Ex.Message.ToString());
9. }
Ok we can fight.
Before fighting the above mentioned eg won't rise any errors. Ok. Here my duty is something else.
If you see the line 6.
catch(Exception Ex) here I am just creating a variable of the type Exception. On line 8. I am calling a Property of the Exception class without creating the instance of Exception. Only initialization is happed in line 6.
How can I call a property of a class without creating an instance of that class ?
Any concept is there like " static property " ? Up to my level best No.
Just think you have different idea on the above mentioned question. Then what Microsoft mean by the signature of Property "Message" in Exception Class.
public virtual string Message {get;}
the above confusion is there for all properties which is available in Exception Class.
One more scenario If I create an instance of Exception class I will get all properties and method which available for the line 8.
What is this ?
Here what is the point creating instance if we want.
Next doubt is about disposing.
I think we can dispose instances of any class. What about the dispose method for an exception class ?
Just think I am creating one instance of Exception class (ins1).
How GC will destruct the inc1. When it destruct ?
Advance thanks for you
Sreejith SS Nair
|
|
|
|