|
How do you mean ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
If there are 2 window applications(if run the exe file, it will pop up a window UI, and input the parameters there). The first one is to do the file format convertion of A to B, and the second application is to do the file format convertion of B to C. Now I want to write a Console application in C# which will call these 2 applications to do the job of converting A to C. Anybody knows how to do it? Thanks!
|
|
|
|
|
How do I pass an array from C# to a COM object.
What is the method parameter syntax for COM object and how does C# use the COM object
|
|
|
|
|
I do something like that:
<br />
public int[] ColumnOrderArray<br />
{<br />
get<br />
{<br />
int iCount = m_ctrl.Columns.Count;<br />
int[] array = new int[ iCount ];<br />
<br />
IntPtr ar = Marshal.AllocHGlobal( iCount * Marshal.SizeOf( typeof(int) ) );<br />
Marshal.Copy( array, 0, ar, iCount );<br />
<br />
WindowsAPI.SendMessage( m_ctrl.Handle, LVM_GETCOLUMNORDERARRAY, iCount, ar );<br />
Marshal.Copy( ar, array, 0, iCount );<br />
Marshal.FreeHGlobal( ar );<br />
return array;<br />
}<br />
set<br />
{<br />
int iCount = m_ctrl.Columns.Count;<br />
if( value.Length > iCount || value.Length < iCount ) return;<br />
<br />
IntPtr ar = Marshal.AllocHGlobal( iCount * Marshal.SizeOf( typeof(int) ) );<br />
Marshal.Copy( value, 0, ar, iCount );<br />
<br />
WindowsAPI.SendMessage( m_ctrl.Handle, LVM_SETCOLUMNORDERARRAY, iCount, ar );<br />
Marshal.FreeHGlobal( ar );<br />
}<br />
}<br />
For better solution look into MSDN by search criteria: Array NEAR COM NEAR Marshal
Alex Kucherenko
|
|
|
|
|
The following code snippet:
namespace myns
{
///
/// ADO.NET data access using the SQL Server Managed Provider.
///
public class Database : IDisposable
{
public int RunProc(string procName)
{
this.close();
}
private SqlCommand CreateCommand(string procName, SqlParameter[] prams)
{
open();
}
private void Open()
{
....
}
public void close()
{
....
}
}
}
I want to know why he use this.close(),but not this.open();
Or open(),but not close()?
Does it relate to public or private define?
I am not using "this" pointer much.
So please give me some guiding or introduce me some online resources.
Thanks.
this is my signature for forums quoted from shog*9:
I can't help but feel, somewhere deep within that withered, bitter, scheming person, there is a small child, frightened, looking a way out.
|
|
|
|
|
Generally the only reason to use this is to get a list from intellisense. The 'this' scope is implied, it will be the first to be looked up, I believe. I doubt there is a reason stronger than that.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Also for disambiguation in, e.g., parameterised construction...
class Customer
{
Customer(string firstName)
{
this.firstName = firstName;
}
private string firstname;
}
Kevin
|
|
|
|
|
Kevin McFarlane wrote:
Also for disambiguation in, e.g., parameterised construction...
Is that a word? I like the sound of it, as it rolls off the tongue so speakeasily!
Mike Stanbrook
mstanbrook@yahoo.com
|
|
|
|
|
I also like the word "defuse"... you know, the opposite of "confuse"
--Mike--
"alyson hannigan is so cute it's crazy" -- Googlism
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
there is a very good reason.
consider inheritance....
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I, too, am still learning about all of this stuff. So I probably know only enough to get myself in trouble.
This is what I know so far about this
If you have multiple threads of an object, I believe that this will differentiate between current thread and some other thread. (or maybe the parent thread(???))
In all of the web examples I've seen there is a heavy use of this for accessing the form fields.
In inherited classes, this also identifies you are refering to a property/method within THIS class vs. the BASE class. (even though you cannot access base methods WITHOUT the base qualifier!)
With the exception of those two reasons, this just makes it easy to pull up an intellisense box while coding.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
Need a function that will return certain system information into a text box.
User Name
Computer Name
Logged into Domain (Yes or No) If Yes then the Domain Name
Logged into Workgroup (Yes or No) If Yes then the Workgroup Name
OS Version
Any Service packs installed?
Listing of Mapped Drives
Thanks,
Derek
|
|
|
|
|
|
oops...forgot to paste these in look here [^]
and here [^]....this should also help
best of luck
Fill me with your knowledge, your wisdom, your coffee.
|
|
|
|
|
I am in the process of moving VB code to C#. However, I have encountered a stumbling block. I have the following code in VB below that uses the Scripting.FileSystemObject and the Scripting.File object. How would I program this property below in C#? Would I use the System.IO.File in place of the Scripting.File object? If so, what would I use for the Scripting.FileSystemObject? Would I open a filestream? If I do, FileSystemObject grabs the whole file, how do I do that using filestreams?
VB Code...
Private mvarFSO As Scripting.FileSystemObject
Private mvarLocalFile As Scripting.File
Public Property Get LocalFile() As Scripting.File
Set mvarLocalFile = Nothing
If mvarFSO.FileExists(mvarMyVSSItem.LocalSpec) Then
Set mvarLocalFile = mvarFSO.GetFile(mvarMyVSSItem.LocalSpec)
End If
Set LocalFile = mvarLocalFile
End Property
C# Translation...
private something_like_FileSystemObject mvarFSO;
private something_like_File_object mvarLocalFile;
public return_type LocalFile
{
get
{
???
return mvarLocalFile;
}
}
Help please, I'm stumped...
Eric
|
|
|
|
|
Not sure how much help this will be but...
You can still use the Scripting.FileSystemObject in C# if you would like. The code would be pretty close to what you have already, just change it to use the new syntax. Very quick and easy.
You can also use the IO libraries provided by .NET but you will, obviously, have to re-do all the code that calls this property. Off the top of my head, I can't really tell you what needs to change but I would probably stick with the Scripting.FileSystemObject if you're porting. It's usually easier to change as little as possible and make sure it's working before moving on.
Cheers,
steve
|
|
|
|
|
Hello, the codegurus around the world.;)
Just hints.
try
{
string tempS = "You need the right path";
FileSystemObject fso = new FileSystemObject();
Scripting.File fInfo = fso.GetFile(tempS);
}
catch {fInfo = null;}
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
using System.IO;
...
private FileInfo mvarLocalFile;
public FileInfo LocalFile
{
get
{
string path = mvarMyVSSItem.LocalSpec;
if (File.Exists(path))
mvarLocalFile = new FileInfo(path);
else
mvarLocalFile = null;
return mvarLocalFile;
}
}
|
|
|
|
|
I would use the System.IO namespace... To me it's more of a cleaner interface than the plain old FileSystemObject. Though I'm partial to C#.
System.IO.FileInfo fileinfo = new System.IO.FileInfo(filename);
fileinfo.Open(System.IO.FileMode.OpenOrCreate);
|
|
|
|
|
Thank you for the help, I got it to work with the code you wrote. Thanks richard_d (on both sites) and joan_fl!!!
|
|
|
|
|
How do you scroll a window in .net? I want to make a RichTextBox scroll to a certain position, without using ScrollToCaret(). I tried using the user32 SetScrollPosition, but that just moves the scroll bar itself. In other words, the scrollbar moves, but the window doesn't scroll.
Is there a ClippingRect object in C#? I can't find it in the Control class..
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
Hi you can make one! But just for the RichTextBox...
private Size contentsize = Size.Empty;
protected Size ContentSize
{
get
{
return contentsize;
}
}
protected override void OnContentsResized ( ContentsResizedEventArgs e )
{
contentsize = e.NewRectangle.Size;
base.OnContentsResized(e);
}
"I dont have a life, I have a program." Also, I won't support any software without the LeppieRules variable.
|
|
|
|
|
And the other part...
[Browsable(false),DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
protected Point ScrollPosition
{
get
{
Point pt = Point.Empty;
User32.SendMessage(base.Handle, Constants.EM_GETSCROLLPOS, 0, ref pt);
return pt;
}
set
{
User32.SendMessage(base.Handle, Constants.EM_SETSCROLLPOS, 0, ref value);
}
}
Obviously you just need to define a User32.SendMessage like:
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, ref Point lParam);
CHeers
"I dont have a life, I have a program." Also, I won't support any software without the LeppieRules variable.
|
|
|
|
|
|
How do you associate a file type (extension) with your application (in .NET if possible)?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|