|
I think this is to do with the streamwriter or something similar.
Target machine is any machine on the network.
Thanks
|
|
|
|
|
File.WriteAllText with a network path, if you have access to the machine. If you don't, then you don't, no matter what.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I didn't realize it was that simple.
Many thanks
|
|
|
|
|
helo every body! (Sorry, english of my bad!)
I want make a program Dictionary, i use one table have 3 two field: words, mean and pronoun. Please tell me the way. thank you very much!
|
|
|
|
|
Well, you could read this[^].
Apart from that, if you have your table layout, the next thing you need is typing. Lots, and lots of typing.
What answer were you hoping for ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
You could maybe use a dictionary, using the word as the key and a definition class instance as value?
Something like:
public class Definition
{
public Definition(string meaning, string pronoun)
{
Meaning = meaning;
Pronoun = pronoun;
}
public string Meaning { get; private set; }
public string Pronoun { get; private set; }
}
Dictionary<string, Definition> definitions = new Dictionary<string, Definition>();
public void AddDefinition(string word, string meaning, string pronoun)
{
definitions.Add(word, new Definition(meaning, pronoun));
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
you can use .netframwork generics or extended generices called powercollection.
|
|
|
|
|
i use Visual C# t build this project.
|
|
|
|
|
I want make a program Dictionary, i use one table have 3 two field: words, mean and pronoun. Please tell me the way. thank you very much!
|
|
|
|
|
Please edit your posts instead of creating new ones.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
we know that there are at least two ways to convert a string to a number, let's say, int:
int.Parse('100')
convert.toInt32('100')
I also read from one book that Convert is at cost of some performance. why? does it mean that it is better to use .Parse() instead of using Convert?
thanks!
|
|
|
|
|
If one were "better" than the other, one of both would be obsolete
If the value you're converting is NULL then Parse [^] will throw an exception, while ToInt32 [^] sets it to the number "0".
I are troll
|
|
|
|
|
OK, I agree your comments,but I concern mainly that which one is more performance efficient, espeically when such function is
used lot of times.
|
|
|
|
|
You should really only ever use TryParse unless you're *certain* there's a number in there. Both operations are costly, they both involve parsing the string and turning it into a number.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi,
Convert.ToInt32 is slower because it additonally checks the null value which int32.parse does not do. Checkout the Int32 function returned by .NET Reflector:
public static int ToInt32(string value)
{
if (value == null)
{
return 0;
}
return int.Parse(value, CultureInfo.CurrentCulture);
}
Convert.ToInt32 also uses int.parse internally. So int.parse is better as far as the performance is concerned. but it may throw exceptions if string value is not specified or an empty string is specified etc. I hope it helps.
Regards
Saank
Either you love IT or leave IT...
|
|
|
|
|
Great, thanks, this is what I want!
|
|
|
|
|
Great to know that this is what you wanted.
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
Hi,
I wan't to create a timer that starts at a given time! The start time will be set in a configuration file in a format HH:MM. After that the timer shall fire off with given intervals. The interval is configured in my configuration file in fomration HH:MM.
How can I do that?
/Håkan
|
|
|
|
|
What have you tried ? Amusingly enough, you will need a timer to check for the right time to start your actual timer, but beyond that, I don't see how this is at all hard.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Look at the System.Threading.Timer class.
You can specify an interval before the first execution and an interval between subsequent execution.
Keep in mind that the Timer class uses TimeSpans and not DateTimes. If you want to use specific times, you can do something like that:
DateTime startDate = DateTime.Today;
startDate.Hour = startHour;
startDate.Minute = startMinute;
TimeSpan interval = new TimeSpan(intervalHour, intervalMinute, 0);
Timer timer = new Timer(MyTimerCallback, null, startDate - DateTime.Now, interval);
|
|
|
|
|
Hello, I've been messing around with some code for a long time and haven't been able to figure out how do to this.. I've messed around with the System.Drawing.Bitmap, and bitmap graphics...
What I need is to get all of the images from a video file (i can do this myself, unless it's super easy to render every frame of an avi file?) and place each image on one large bitmap. Each image has to be converted to a power of 2 dimension (256x256, 512x256,1024x512, etc) and placed 1 blue pixel apart.
Here is an image example..
First image,
|
|
|
|
|
Ok, interesting problem, but I don't understand - what are you having trouble with? It looks like you're well on your way of finishing it
Is it just that the blue border is too big? (how did you make it?)
|
|
|
|
|
Oh, I'm sorry. I need help with code to do that, That was just an example of what needs to happen.
And here is code in VB i was working with awhile back, i'm not sure if it was ever finished.. loaded up in visual studio gives me the error
Error 1 Overload resolution failed because no accessible 'DrawImage' can be called with these arguments:
'Public Sub DrawImage(image As System.Drawing.Image, x As Integer, y As Integer)': Value of type 'System.Drawing.Brush' cannot be converted to 'System.Drawing.Image'.
'Public Sub DrawImage(image As System.Drawing.Image, x As Single, y As Single)': Value of type 'System.Drawing.Brush' cannot be converted to 'System.Drawing.Image'. N:\XP\My Docs\My Documents\Visual Studio 2008\Projects\HaloVideo\****Video\Form1.vb 12 9 ****Video
Dim img3 As New Bitmap(PictureBox1.Image.Height + PictureBox2.Image.Height, PictureBox1.Image.Width)
Dim g As Graphics = Graphics.FromImage(img3)
g.DrawImage(Brushes.Blue, 0, 0)
g.DrawImage(PictureBox1.Image, 0, 0)
g.DrawImage(PictureBox2.Image, PictureBox2.Image.Width + 1, 0)
PictureBox3.Image = img3
But i need for C#, and i need it to actually do what i want it to do. lol
I guess a way would to possibly have a blue background graphic and then overlay images ontop of it with 1 px distance from eachother?
|
|
|
|
|
Sounds trivial to me. What have you tried ? Why are you creating bitmaps that are too big, if you only want one pixel borders ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hello,
I have created a vbscript called sample.vbs
This file contains a simple script to create a Test.Log file on the C drive of the target machine. This script works as it has been tested.
The code below runs the script (sample.vbs) located on mylocalmachine against a remote machine i.e. Servermachine
There is no error but the file i.e. Test.Log does not appear in the c drive of the target machine i.e. Servermachine
please note that if I make the target machine as the local machine i.e. myLocalMachine then the Test.Log file does appear in the c drive.
Question:
can you please let me know why this code does not create the file on the target machine?
The vbscript in sample.vbs in case you are interested is shown at the bottom of this message.
Thank you
try
{
string stringCommandLine = @"cscript.exe \\myLocalMachine\c$\work\sample.vbs";
System.Management.ManagementOperationObserver observer = new System.Management.ManagementOperationObserver();
System.Management.ConnectionOptions conn = new System.Management.ConnectionOptions();
conn.Impersonation = ImpersonationLevel.Impersonate;
conn.EnablePrivileges=true;
conn.Authentication=AuthenticationLevel.Default;
System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\" + "Servermachine" + "\\root\\cimv2", conn);
//System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\" + "myLocalMachine" + "\\root\\cimv2", conn);
ms.Connect();
System.Management.ManagementPath path = new System.Management.ManagementPath("Win32_Process");
System.Management.ManagementClass processClass = new System.Management.ManagementClass(ms, path, null);
object[] methodArgs = { stringCommandLine, null, null, 0 };
uint result = (uint)processClass.InvokeMethod("Create", methodArgs);
}
catch (ManagementException err)
{
MessageBox.Show("An error occurred while trying to execute the WMI method: " + err.Message);
}
catch (System.UnauthorizedAccessException unauthorizedErr)
{
MessageBox.Show("Connection error (user name or password might be incorrect): " + unauthorizedErr.Message);
}
///////////////////////////
////sample.vbs
Dim fso ' FileSystemObject
Dim f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateTextFile("c:\test.log", True, True)
f.WriteLine("This is generated by test.vbs at " & Now)
f.Close()
|
|
|
|