|
hamidreza_buddy wrote:
ive heard that c# is the mother of .Net
LOL - that's great.
C# is definately easier to learn than C++.NET, and I'd recommend it. I use C# much more than MC++, and I'm a C++ MVP, so I know my C++ pretty well. I just find C# to be better, MC++ is a hack on the side of C++.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have an imagelist with a few pngs loaded into it set to the SmallImageList property of a ListView control.
Now all is well, the images are shown in the first column (details view), but when an item is selected the image disappears and the item becomes selected.
Does anybody know what the problem is?
Thanks in advance.
|
|
|
|
|
Hi,
I have a .NET app, which needs to load multiple WebBrowser controls at startup (MDI app, multiple instances of one wrapper form containing just a WebBrowser control).
The problem is, they take AGES to load, and i just cannot find a way of loading them asynchronously or in a multithreaded environment, as all the loading gets done in the object constructor, and I cannot pass objects between threads, so I cannot load in a seperate worker thread.
This produces a half-rendered application window during startup, as no paint messages are processed, which looks pretty naff. Can anyone help me please?
Mankeyrabbit
|
|
|
|
|
Hi. In my code I have a PrintDialog that allows the user to select a page range to print. I've been following the API documentation as well as articles/tutorials online but I still can't get it to work. Multiple copies print fine. Print to File works fine. Just the page range doesn't work.
I've tried manually setting the ToPage and FromPage members in the PrintDocument's PrinterSettings and DefaultPrinterSettings members as well as in the PrintDialog's PrinterSettings member. I've also set the MinimumPages and MaximumPages in each one with no success.
Here's my code (...well the latest version anyway). I really don't know what I'm doing wrong. Any help at solving my problem would be very appreciated.
Public PageCount As Integer
WithEvents Doc As New PrintDocument
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Diag As New PrintDialog
Diag.Document = Doc
Diag.AllowSomePages = True
Diag.PrinterSettings.MinimumPage = 1
Diag.PrinterSettings.MaximumPage = 3
Diag.PrinterSettings.FromPage = 1
Diag.PrinterSettings.ToPage = 3
If Diag.ShowDialog() = DialogResult.OK Then
PageCount = 1
Doc.Print()
End If
End Sub
Private Sub PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles Doc.PrintPage
'Dim f As New Font(FontFamily.GenericSerif, 18, FontStyle.Regular)
'e.Graphics.DrawString("Page #" & PageCount, f, Brushes.Black, 10, 10)
PageCount += 1
If PageCount <= 3 Then
e.HasMorePages = True
End If
End Sub
|
|
|
|
|
Nevermind. I've solved the problem.
|
|
|
|
|
How do i parse the url or the type of resources requested by a client in mshtml programming ?? I got problem while downloading html page, it did not work. At last i could come to know it was a word file .
love2code
|
|
|
|
|
hi!
i wanted to create an instance of a web service using the Assembly.CreateInstance("FullPath") method.
but it doesnt create the instance. but if i use this same line of code for the other class that i have in my project then it works fine but its not working in case of a web service. i think i am giving the correct namespace but i dont know why it isnt working...
the example code goes like this.
e.g i am using google service then the name space of the proxy class created is:
CommManager.Google
so i use this:
Assembly asm = Assembly.GetExecutingAssembly();
object serviceToCall = null;
serviceToCall = asm.CreateInstance("CommManager.Google.GoogleSearchService", true);
where GoogleSearchService is class whose instance i want to create.
but this line of code returns null.
Help is really appreciated!!!!
KZ
|
|
|
|
|
I want to bind a NumericUpAndDown to an int property. But when I just bind the "Value" of the NumericUpAndDown then the property doesn't get updated when I type a value. When I just bind the "Text" of the NumericUpAndDown the property doesn't get updated when I push the up/down buttons. When I bind both it seems to work properly, but is this the right way to work with the NumericUpAndDown? Seems like slightly wierd behaviour by this control.
Here's the code for binding:
<br />
private System.Windows.Forms.NumericUpDown numericUpDown1;<br />
private System.Windows.Forms.Button button1;<br />
private System.ComponentModel.Container components = null;<br />
private int i;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
numericUpDown1.DataBindings.Add("Text", this, "I");<br />
numericUpDown1.DataBindings.Add("Value", this, "I");<br />
}<br />
<br />
public int I {<br />
get {<br />
return i;<br />
}<br />
set {<br />
i = value;<br />
}<br />
}<br />
<br />
Wout
|
|
|
|
|
Please, talk to me about:
How do you get list of machines in LAN by VB.NET?
Thanks very muchs.
Phuoc Tuyen
|
|
|
|
|
You talking about a list of Servers on your LAN? Because there are ways to enumerate SQL Servers and all servers on your LAN, is this what you are looking for?
|
|
|
|
|
Hi,
Is there a way to convert a DataSet (rows of its tables) to IEnumerator?
I need to do this in order to work with .NET table-valued UDF in SQL 2005.
Basically, I want my custom .NET User Defined Function to return a DataSet I build in code.
Thanks!
|
|
|
|
|
Hmmm.... I suspect if you have more than one table, you might have to create a default view that merges them somehow, then you could use the Rows property.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi Christian,
I'm having a hard time sending the data of a datatable back from a stored procedure or a TVF (table-valued function).
I expected to be able to do Pipe.Send(table) or Pipe.Send(dataSet) from stored procedure or return table from a TVF but unfortunately, it's not that easy.
Have you been able to do something similar? I'm searching everywhere but cannot find anything good.
The idea of having SPROC and UDF done in CLR is amazing, but I think MS's implementation of it is lacking major features. All the examples I see are just wrappers, which makes no sense. I need to generate DataSets on the fly (in code), modify their values, get data from different datasources and send the result back.
If you can help, it would be very much appreciated.
Thanks!
Carl
|
|
|
|
|
Carl, I will be reading the managed code part of my new SS2005 book tonight. I'll let you know if I can help tomorrow, but right now I am excited, but clueless.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What book do you have? I have "First Look at SQL Server 2005 For Developers", but imho, it's lacking information about writing managed code for SQL Server.
|
|
|
|
|
Pipe.Send takes another object, whose name escapes me now, which acts as a cursor. I have the same book.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
SqlDataReader. Pretty useless if you ask me!
A SqlDataReader will pretty much only allow you to wrap another SQL statement.
Alazel Acheson (MS SQL Developer) has posted some GREAT code on the private Microsoft newsgroups. It allows me to return a dataset or datatable to the pipe. Here it is, for the record:
public static void SendDataSet( DataSet ds )<br />
{<br />
foreach( DataTable dt in ds.Tables )<br />
{<br />
SendDataTable( dt );<br />
}<br />
}<br />
<br />
<br />
public static void SendDataTable( DataTable dt )<br />
{<br />
bool[] coerceToString;
SqlMetaData[] metaData = ExtractDataTableColumnMetaData( dt, out coerceToString );<br />
<br />
SqlDataRecord record = new SqlDataRecord( metaData );<br />
SqlPipe pipe = SqlContext.Pipe;<br />
pipe.SendResultsStart( record );<br />
try {<br />
foreach( DataRow row in dt.Rows )<br />
{<br />
for( int index=0; index<record.FieldCount; index++ )<br />
{<br />
object value = row[ index ];<br />
if ( null != value && coerceToString[ index ] )<br />
value = value.ToString( );<br />
record.SetValue( index, value );<br />
}<br />
<br />
pipe.SendResultsRow( record );<br />
}<br />
}<br />
finally<br />
{<br />
pipe.SendResultsEnd( );<br />
}<br />
}<br />
<br />
private static SqlMetaData[] ExtractDataTableColumnMetaData( DataTable dt, out bool[] coerceToString )<br />
{<br />
SqlMetaData[] metaDataResult = new SqlMetaData[ dt.Columns.Count ];<br />
coerceToString = new bool[ dt.Columns.Count ];<br />
for( int index = 0; index < dt.Columns.Count; index++ )<br />
{<br />
DataColumn column = dt.Columns[ index ];<br />
metaDataResult[ index ] = SqlMetaDataFromColumn( column, out coerceToString[ index ] );<br />
}<br />
<br />
return metaDataResult;<br />
}<br />
<br />
private static Exception InvalidDataTypeCode( TypeCode code )<br />
{<br />
return new ArgumentException( "Invalid type: " + code );<br />
}<br />
<br />
private static Exception UnknownDataType( Type clrType )<br />
{<br />
return new ArgumentException( "Unknown type: " + clrType );<br />
}<br />
<br />
private static SqlMetaData SqlMetaDataFromColumn( DataColumn column, out bool coerceToString )<br />
{<br />
coerceToString = false;<br />
SqlMetaData smd = null;<br />
Type clrType = column.DataType;<br />
string name = column.ColumnName;<br />
switch ( Type.GetTypeCode( clrType ) )<br />
{<br />
case TypeCode.Boolean: smd = new SqlMetaData( name, SqlDbType.Bit ); break;<br />
case TypeCode.Byte: smd = new SqlMetaData( name, SqlDbType.TinyInt ); break;<br />
case TypeCode.Char: smd = new SqlMetaData( name, SqlDbType.NVarChar, 1 ); break;<br />
case TypeCode.DateTime: smd = new SqlMetaData( name, SqlDbType.DateTime ); break;<br />
case TypeCode.DBNull: throw InvalidDataTypeCode( TypeCode.DBNull );<br />
case TypeCode.Decimal: smd = new SqlMetaData( name, SqlDbType.Decimal, 18, 0 ); break;<br />
case TypeCode.Double: smd = new SqlMetaData( name, SqlDbType.Float ); break;<br />
case TypeCode.Empty: throw InvalidDataTypeCode( TypeCode.Empty );<br />
case TypeCode.Int16: smd = new SqlMetaData( name, SqlDbType.SmallInt ); break;<br />
case TypeCode.Int32: smd = new SqlMetaData( name, SqlDbType.Int ); break;<br />
case TypeCode.Int64: smd = new SqlMetaData( name, SqlDbType.BigInt ); break;<br />
case TypeCode.SByte: throw InvalidDataTypeCode( TypeCode.SByte );<br />
case TypeCode.Single: smd = new SqlMetaData( name, SqlDbType.Real ); break;<br />
case TypeCode.String: smd = new SqlMetaData( name, SqlDbType.NVarChar, column.MaxLength );<br />
break;<br />
case TypeCode.UInt16: throw InvalidDataTypeCode( TypeCode.UInt16 );<br />
case TypeCode.UInt32: throw InvalidDataTypeCode( TypeCode.UInt32 );<br />
case TypeCode.UInt64: throw InvalidDataTypeCode( TypeCode.UInt64 );<br />
case TypeCode.Object:<br />
if ( clrType == typeof( System.Byte[] ) || clrType == typeof( SqlBinary ) || clrType == typeof( SqlBytes ) ||<br />
clrType == typeof( System.Char[] ) || clrType == typeof( SqlString ) || clrType == typeof( SqlChars ) )<br />
smd = new SqlMetaData( name, SqlDbType.VarBinary, column.MaxLength );<br />
else if ( clrType == typeof( System.Guid ) )<br />
smd = new SqlMetaData( name, SqlDbType.UniqueIdentifier );<br />
else if ( clrType == typeof( System.Object ) )<br />
smd = new SqlMetaData( name, SqlDbType.Variant );<br />
else if ( clrType == typeof( SqlBoolean ) )<br />
smd = new SqlMetaData( name, SqlDbType.Bit );<br />
else if ( clrType == typeof( SqlByte ) )<br />
smd = new SqlMetaData( name, SqlDbType.TinyInt );<br />
else if ( clrType == typeof( SqlDateTime ) )<br />
smd = new SqlMetaData( name, SqlDbType.DateTime );<br />
else if ( clrType == typeof( SqlDouble ) )<br />
smd = new SqlMetaData( name, SqlDbType.Float );<br />
else if ( clrType == typeof( SqlGuid ) )<br />
smd = new SqlMetaData( name, SqlDbType.UniqueIdentifier );<br />
else if ( clrType == typeof( SqlInt16 ) )<br />
smd = new SqlMetaData( name, SqlDbType.SmallInt );<br />
else if ( clrType == typeof( SqlInt32 ) )<br />
smd = new SqlMetaData( name, SqlDbType.Int );<br />
else if ( clrType == typeof( SqlInt64 ) )<br />
smd = new SqlMetaData( name, SqlDbType.BigInt );<br />
else if ( clrType == typeof( SqlMoney ) )<br />
smd = new SqlMetaData( name, SqlDbType.Money );<br />
else if ( clrType == typeof( SqlDecimal ) )<br />
smd = new SqlMetaData( name, SqlDbType.Decimal, SqlDecimal.MaxPrecision, 0 );<br />
else if ( clrType == typeof( SqlSingle ) )<br />
smd = new SqlMetaData( name, SqlDbType.Real );<br />
else if ( clrType == typeof( SqlXml ) )<br />
smd = new SqlMetaData( name, SqlDbType.Xml );<br />
else<br />
{<br />
smd = new SqlMetaData( name, SqlDbType.NVarChar, column.MaxLength );<br />
coerceToString = true;<br />
}<br />
break;<br />
<br />
<br />
default: throw UnknownDataType( clrType );<br />
}<br />
<br />
return smd;<br />
}<br />
<br />
|
|
|
|
|
Hi All,
Could anybody help me out in identifying the association between the
.NET's ReleaseComObject() method and the Dispose Pattern? Are they are
similar things and serves the same purpose. Are they substitute of each
other?
This issue has become really hot for our project. Itwill be really
great if the xpert people can provide their corresponding usage for
real world applications. Differences/ Similarties between them and what
exactly they serves?
Please share your expertise and provide me some good database of
knowledge.
Thanks in advance.
Deeps
Hi All,
Could anybody help me out in identifying the association between the
.NET's ReleaseComObject() method and the Dispose Pattern? Are they are
similar things and serves the same purpose. Are they substitute of each
other?
This issue has become really hot for our project. Itwill be really
great if the xpert people can provide their corresponding usage for
real world applications. Differences/ Similarties between them and what
exactly they serves?
Please share your expertise and provide me some good database of
knowledge.
Thanks in advance.
Deeps
|
|
|
|
|
I want to create an auto response form using .net and vb.net or any other language,so that i can give instant response on my my site once a user fills a form ,Cant figure out how to do,tried but not working .
woleraymond
|
|
|
|
|
Did you try classes in the System.Web.Mail namespace?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi guys
I put some textBoxes in a form & need to let users type in one of the UTF8 languages but don't want to require them to change the language each time (not from language bar nor Alt+Shift)
Is there any specific method in dotNet or i need to override onKeyDown/press or whatever. All i can think of is mapping each EventArgs.keycode to a hexadecimal form of the corresponding unicode character 'uxxxx'?
or transpose values to get to the desired subrange in unicode?
I used Decoder.GetChars & it gives me 2 bytes for each char. How can i use these 2 bytes to transpose input char to the desired language equal?
Thanx for any hints
|
|
|
|
|
u stupid junk didn't need to spend that much time overriding OnKeyDown & do lots of mappings. U need to use InputLanguage Class
|
|
|
|
|
Hello,
I´m new in developing for Smart Devices and I use Visual Studio 2005 Beta to develop a small c# Application that runs on a Pocket PC 2003 SE with CF2.0.
But I have a small Problem: When I copy the EXE to my Device and start my application, the application is not shown in the List of running applications?! Whenever my application runs and I open the Today Screen there is no way to get back to my application. The only way is to start the exe again! Do I have to write something in my sourcecode so that the application is shown in the List?
I hope that someone has a hint for me because I don´t know what to do
Thank you
twickl
|
|
|
|
|
Hi There!
I noticed two problems with .NET System.Windows.Forms.RichTextBox object:
1. While firing ContextMenu.Popup event from a RichTextBox object, the ContextMenu.SourceControl is always null.
2. If I want to set a menuItem Enabled or not (e.g.: Cut, Copy, Reverse, etc.) according to whether there is selected text in a RichTextBox object (I test SelectionLength > 0 or Selected{Text||Rtf}.Length > 0 during Application.Idle event and then update the command and menuItem state), I get a problem with DBCS input: the Chinese IME doesn't work anymore, the Korean IME works letter by letter instead of composing hangul characters, and the Japanese IME works randomly. As soon as I take off the test of those Selection related properties, I can do DBCS input perfectly within RichTextBox objects.
Does anybody have a clue why there are those problems and how to work around?
Thanks in advance!
Jian Yang
|
|
|
|
|
Hey Guys
I have an HTMLDocument and i want to be able to get an image on the website and display it in a listview. I can get the HTMLImage class loaded with the image element but can't seem to get the actuall image so i can display it. I have tried laoding it into a Image class but it says it won't load from a URL. Does anyone know how i would go about doing this?
Cheers
Pete
|
|
|
|
|