|
I dont know how to use it
I will read MSDN...
|---------------|
| theJazzyBrain |
|---------------|
|
|
|
|
|
Like this:
<br />
private IDbConnection objConnection;<br />
objConnection will now take either a SqlConnection or a OleDbConnection object.
(objConnection = new SqlConnection(); or objConnection = new OleDbConnection(); will work equally well...)
The IDbConnection interface has the Open() and Close() methods, so you don't have to do casts to use them...
objConnection.Open();
|
|
|
|
|
this is looking good...
than you
|---------------|
| theJazzyBrain |
|---------------|
|
|
|
|
|
Hi,
I'm looking for a mean to use printer fonts in c# or vb.net
I've tried with drawing.text.installedFontCollection, but i doesn't find the printer fonts only system fonts
In VB6 there is a very simple function : Printer.Fonts()
How can i do this in .NET
can somebody help me?
thx
|
|
|
|
|
Are you sure printer fonts are not the same as system fonts in .Net?
Mazy
No sig. available now.
|
|
|
|
|
i don't know but i've not access to them.
When i am looking after the font name in wordpad for exemple: "ZB:Code 128" and use it in .NET i doesn't work, .net creates a default font.
|
|
|
|
|
Hi.
I created winform application.
And There is a empty tabcontrol. When i click menuitem to add tabpage,
i create tabpage and add tabpage to tabcontrol.
It is simple.^^
But, What i want to do is to hadle tabpage focus.
When i press mouse right button on a tabpage,the tabpage must have focus and
show the context menu. when i clicked context menu to close tabpage,that tabpage must be closed.
I don't know how to get the tabpage reference,when i press a right mouse button. Would you tell me the way to solve this problem?
As soon as possibe,i hope you write sample codes.
Help me,please.
|
|
|
|
|
I know how to bind a web treeview to an XML data source, but not how to bind a Windows Forms treeview to an XML data source. Is this even possible? (BTW, I'm not talking about binding just any property - I'm talking about binding the nodes.)
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
How would I change this darn VB.net code to C#?
Public Function AddPortalInfo(ByVal PortalName As String,
ByVal PortalAlias As String, Optional ByVal Currency As String = "",
Optional ByVal FirstName As String = "", Optional ByVal LastName As String = "",
Optional ByVal Username As String = "", Optional ByVal Password As String = "",
Optional ByVal Email As String = "", Optional ByVal ExpiryDate As String = "",
Optional ByVal HostFee As Double = 0, Optional ByVal HostSpace As Double = 0,
Optional ByVal SiteLogHistory As Integer = -1, <SqlParameter(, , , , , ParameterDirection.Output)>
Optional ByVal PortalId As Integer = -1) As Integer
Dim myConnection As New SqlConnection(GetDBConnectionString)
' Generate Command Object based on Method
Dim myCommand As SqlCommand = SqlCommandGenerator.GenerateCommand(myConnection, _
CType(MethodBase.GetCurrentMethod(), MethodInfo), _
New Object() {PortalName, PortalAlias, IIf(Currency <> "", Currency, "USD"),
FirstName, LastName, Username, Password, Email, IIf(ExpiryDate <> "", ExpiryDate, SqlInt16.Null),
HostFee, HostSpace, IIf(SiteLogHistory <> -1, SiteLogHistory, SqlInt16.Null), PortalId})
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
Return CInt(myCommand.Parameters("@PortalID").Value)
End Function
I never got into vb.net so I have no idea what to do with the Optional keyword. Does that mean I have to makie a bunch of overloads of this functionin C#?
<SqlParameter(, , , , , ParameterDirection.Output)> wtf is that?
How do I get around the IIf thing (does that mean if and only if ?
Thanks for any clarification on this garbage;)
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
1. There is no equivalent for optional in C# you it looks like you might have to overload your function
2.sqlparameter is an attribute. C# defines it's attributes with '[' instead '<'
3. use the "?::" notation in C#, as in
expression<code>?</code>what to do if true<code>:</code>what to do when false;
Nick Seng (the programmer formerly known as Notorious SMC)
God, I pity me! - Phoncible P. Bone
|
|
|
|
|
Thanks
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
Steve McLenithan wrote:
Does that mean I have to makie a bunch of overloads of this functionin C#?
Yes.
You could:
*Do lots of overloads that delegate to a single function.
*Do lots of overloads that each do the job slightly differently.
*Force people to pass null to all the values they don't use, and check for null as necessary.
Steve McLenithan wrote:
<sqlparameter(, ,="" parameterdirection.output)=""> wtf is that?
That's how VB.NET does attributes, but I thought SqlParameter was a regular class, not an attribute.
Steve McLenithan wrote:
How do I get around the IIf thing (does that mean if and only if?
In C#, this:
IIf(ExpiryDate <> "", ExpiryDate, SqlInt16.Null)
becomes this:
(ExpiryDate != "" ? ExpiryDate : SqlInt16.Null)
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
|
|
Nothing... It's the challenge. It's the whole point of my project;)
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
|
Nice very nice. What a HUGE time saver. Thanks.
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
As I was practicing my C# skills I came across the code below:
int myFunc()
{
int x;
x = 42;
x++;
x += --x;
return x;
}
What is the value returned from myFunc() ?
As a C++ programmer I thought: "84 of course".
But when I compiled with C#, the function returns 85 .
Just to confirm, I also compiled the same code with Java and returned 85 too.
Well... Can anyone explain this? :P
modified 25-May-20 21:50pm.
|
|
|
|
|
I don't see how C++ would return 84??
int x; x = 0
x = 42; x = 42
x++; x = 43
x += --x; == x = x + (--x) == x = 43 + 42 x = 85
Is there something I'm missing??
Admittedly, I haven't done C++ in a while
Nick Seng (the programmer formerly known as Notorious SMC)
God, I pity me! - Phoncible P. Bone
|
|
|
|
|
|
hmmm..... Shouldn't it be left to right(order of operation) ?
I mean:
x = x + (--x) : At the beginning of this line x is still 43
x = x + (--x) : which would imply that this x is still 43
thus, you would get 85?
[Edit]Something just occured to me, does, --x imply that the incrementer execute before any other operators? [/Edit]
Nick Seng (the programmer formerly known as Notorious SMC)
God, I pity me! - Phoncible P. Bone
|
|
|
|
|
The -- operator has precedence over the += so it goes first makeing x 42 then the += is 42 + 42.
Maybe this is a bug in c#? -- is supposed to go first in c# also.
Maybe it doens't update x until the whole statement is done, and only returns 42 to the statement so you get 43 + 42.
|
|
|
|
|
Hi! I've posted this same question in the Microsoft C# Newsgroups and they said that the operator += has precedence over the -- because C# goes from left to right... (instead of C++ that goes from the right to the left)
So the expression:
x += --x
Would be:
x = --(x + x) = --(43 + 43) = 85
Nice... but weird :P
modified 25-May-20 21:52pm.
|
|
|
|
|
Thanks for the info. I don't know if I agree with that though. Whether you eval from left to right or right to left, you still should evaluate in the proper precedence. The c# spec says that -- has precedence over +=.
If you are interested it is in the spec section 7.2.1
|
|
|
|
|
The decrement operator ( -- ) decrements its operand by 1. The decrement operator can appear before or after its operand:
The first form is a prefix decrement operation. The result of the operation is the value of the operand after it has been decremented.
The second form is a postfix decrement operation. The result of the operation is the value of the operand before it has been decremented.
Bo Hunter
|
|
|
|