|
Hi Chritian
I'll be very honest with you. I am a control and Electrical person who has no prior ecperience in high level language. NONE what so ever. Currently, what I'm doing is trying (really hard) to undertand people's programming codes (that's how I study this language) in addition to study the basic concept of C#. Since I am really- really new,I am unable to develop any codes cause it's hard enough for me to understnd the coding itself he!he!. Now I only manage to open and save file. I am still finding a way (whihc I doubt) to program the application stated before. Anyway, Christian I appreciate your fast responses an d you ever find codes that;s relevant to my rewuirements, please email them to me okay. Thank you again.
M
|
|
|
|
|
Hello
I want to make a preferences/settings dialog where you can click on a node in a treeview and then the controls to the right where you can change the settings change. How do I make this? Do I have alot of panal controls, fill them with what I want and then make one visible and the rest invisible or are there a better way?
Tips and ideas are very appreciated!
Thanks in advance!
~~~~~~~~~~~~~~
Martin Lundberg
Student, Sweden
I have to thank every member of the Code Project for making it such a great place for a beginner to learn!
|
|
|
|
|
Implement every settings page as a separate UserControl.
When clicking on a tree node destroy the control currently visible and create
a new one corresponding to your entry.
You might want to consider having a settings class that will subscribe to events inside the controls on your UserControls to store the values of your preferences. However if the amount of settings groups/subgroups is not that great, I would recommend using the traditional tabbed dialog design instead.
|
|
|
|
|
i draw some rectangle into my form and when i minize the rectangles disappeared how to slove this problem ?
|
|
|
|
|
Are you using the OnPaint event, and drawing it every time the form repaints?
|
|
|
|
|
1.Overide OnPaint Event and write all the painting algorithm inside this.
2. Use graphics object obtained from PaintEventArgs's Graphics property. This will ensure non-flickering during painting.
protected override void OnPaint ( System.Windows.Forms.PaintEventArgs e )
{
Graphics g = e.Graphics;
}
Do revert back whether it could solve your problem or not?
Regards,
Jay.
|
|
|
|
|
Hi everybody.
I got a WinSock related question. This is mainly about C#. I find C# to be very strage in this problem... maybe because I'm a begginer in C#. I'm using the GetData method to retrieve some data a socket received. Here is the data about this method:
Void axWinsock.GetData (ref object data, object type, object maxLen)
In Visual Basic .Net the last two parameters are optional. But in C# you MUST provide them, otherwise the function will not work. I tried this... (in Socket_DataArrival)
object oRData;
oRData = "";
Socket.GetData(ref oRData, (object) null, (object) null);
After casting nulls to objects it worked, but I`m not sure if this is how I can avoid using those parameters. I`m not sure if the function will work.
But the big question is... HOW DO I GET THAT DATA OUT OF my object variable, oRData. Pfff... I tried casting it to a string but that doesn't work. In fact,
object oRData;
oRData = "";
IRC.GetData(ref oRData, (object) null, (object) null);
MessageBox.Show ("Test");
When using a breakpoint... the GetData method gets executed, but surprise surprise... the Message Box is never displayed. It's just like the GetData method crashes the entire DataArrival event.
I`m totally puzzled ... anybody know anything?
Thank you in advance, have a nice day/night
The Greater Mind Balance
|
|
|
|
|
How do I open up a windows shell folder properties dialog from dotNet?
I would prefer doing it purelly managed, but if required there's no real reason not to use interop (as I suppose I'd have to)
|
|
|
|
|
My console project is named UsingConfigSettings in C#, and wanted to store the database connection in an application config file. I added an application config named "UsingConfigSettings.exe.config" in my project. Here is its contents:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="constring" value="server=localhost;database=Northwind;uid=sa;pwd=;"/>
</appSettings>
</configuration>
I even copied it in the bin\debug folder in my C# console application, but it still doesn't work. I acccess it in the console as:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public class UsingConfigSettings
{
public static void Main()
{
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["constring"]);
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "SELECT * FROM Customers";
cmd.Connection = con;
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
Console.WriteLine("{0} - {1}", reader.GetString(0), reader.GetString(1));
}
con.Close();
Console.ReadLine();
}
}
but it won't work, it always issued a message of:
"An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: The ConnectionString property has not been initialized."
If I don't use any config file, and replace the code above, it works fine:
SqlConnection con = new SqlConnection("server=localhost;database=Northwind;uid=sa;pwd=;");
Please help.
|
|
|
|
|
Hi all,
How can we query xml data between two dates by using XPath.
For example:
I have an XML file like this
"<Employees>
<Employee>
<Name>xxxx</Name>
<DateOfJoin>'2000-04-12T10:12:30'</DateOfJoin>
</Employee>
<Employee>
<Name>yyyy</Name>
<DateOfJoin>'2001-04-12T10:12:30'</DateOfJoin>
</Employee>
<Employee>
<Name>zzzz</Name>
<DateOfJoin>'2002-04-12T10:12:30'</DateOfJoin>
</Employee>
<Employee>
<Name>aaaa</Name>
<DateOfJoin>'2003-04-12T10:12:30'</DateOfJoin>
</Employee>
<Employee>
<Name>bbbb</Name>
<DateOfJoin>'2004-04-12T10:12:30'</DateOfJoin>
</Employee>
</Employees>"
Now I want employee names between 2002 and 2003.
Thanks inadvance.
|
|
|
|
|
Your question would be better answered in the XML/XSL Forum. Not the C# Forum...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well, I am searching for amlost 3 hours on internet for any article that shows comparison between "MSIL", "JAVA Bytecode" and "Intel Assembly Language", but couldnt even fine ONE
Anyone here to help me?
TIA
|
|
|
|
|
Thats strange, I typed "il bytecode comparison" in google and got several thousand results.
my blog
|
|
|
|
|
Look at some open source software!
GAS - GNU assembler (supports AT&T and Intel style)
HLA - High level assembly
MSIL - Portable .NET , Mono
JAVA - many opensource stuff, look the IKVM.NET too (included with mono), also the GNU Class path stuff.
What your are asking is a for something like compare all the apples in 3 countries..... You just have to do it your self. MSIL vs JAVA byte code shouldnt be to difficult, however native CPU assembly is different from platform to platform , even huge differences on the same platform.
top secret xacc-ide 0.0.1
|
|
|
|
|
My questions would be: What do you want to compare? What's the point of the comparison?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to read the address of LPT (parallel port) and the COM port (RS232) by the code in C#
|
|
|
|
|
Im thinking of a way to input text into a textbox of another application. Supposing that I have the handle to that textbox.
Right now the only way of doing something like that, that I can think of, involves breaking up the needed string input into characters. Then posting a WM_KEYDOWN message or something for each character to the textbox. I'm not even sure if thats possible. Anybody has an idea?
I tried to find something that would allow me to change the text property of the textbox or WM_SOMEMESSAGE that would allow me to do what I want, as well as various API functions etc., but I had no luck. Can anybody point me in the right (some) direction. I'm running out of ideas. The method I mentioned above seems unnecesarily complicated, but I might be forced to do it that way. Well I'm gonna go look for some api functions again. I hope someone has an idea.
Thank you.
|
|
|
|
|
If you have the handle to the textbox you want to set the text of, you can simply P/Invoke SendMessage and pass the handle with the corresponding WM_SETTEXT message.
[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
int WM_SETTEXT = 0x000C;
string text = "Hello";
SendMessage(YourHandle, WM_SETTEXT, null, text);
- Nick Parker My Blog | My Articles
|
|
|
|
|
I sent EM_SETSEL and then EM_REPLACESEL, but SETTEXT seems easier. Plus one less overload of SendMessage() to have. I have about 4 sending different messages with different parameter types.
Thanks.
|
|
|
|
|
I tried to add a <myapp>.exe.config in the bin\debug folder in my C# console application, even added it in the project, but it still doesn't work. Here's the code in the config:
<configuration>
<appsettings>
<add key="constring"
="" value="server=localhost;database=Northwind;uid=sa;pwd=;">
I acccess it in the console as :
con = new SqlConnection(ConfigurationSettings.AppSettings["constring"]);
but it won't work, always issued a connection string not set error.
If I don't use any config file, it works fine:
con = new SqlConnection("server=localhost;database=Northwind;uid=sa;pwd=;");
Please help.
|
|
|
|
|
Your original post has not come out very well - part of the XML has been lost. If you replace the < with < we can see what you are trying to do.
As a general rule, it can be good to populate a string first, then pass the string as a parameter, when extracting a string like this.
string theConnectionString = ConfigurationSettings.AppSettings["constring"];
con = new SqlConnection(theConnectionString);
This way you can set a breakpoint and see exactly what the connection string is.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Hello.
I've got the following problem:
I created a windows installer project that installs my application.
The application works with some files. I want to include some
example files with the installation package.
These files by no means are critical for the application itself.
They are included only to help application user to get aquaintanced
with the app.
The problem occurs when the example files are deleted after
installation: When user clicks on the shortcut to the application
(on his desktop) the application installer is started instead
of the application itself. The installation process restores
the "missing" files, and the applcation is allowed to start normally
afterwards. But this is greatly annoying (!), that every application
launch involves reinstallation (that lasts 2-3 min).
How to designate some files, that the installer should not care for them _afterwards_ installation process ??
I found "vital" property of file, but this (as documentation
confirms) specifies whether a file is vital or not, during installation (i.e. the installation fails if the file cannot be properly installed). I set this to false but in vain. Still deleting example files causes the problem.
I want a file to be deletable [i.e. not causing reinstallation]
Is it possible ?
Thank You
Michał
|
|
|
|
|
Since windows installer seems to behave strangely sometimes you could write your own Installer class to copy the files yourself and then include it as a custom action into your setup project.
Might be worth a try...
|
|
|
|
|
Hi,
I'm looking for a database that will have all provinces, towns for each country
and translated in spanish and english.
Does anyone have such a database ? where can i find this ?
thanks for any help on the subjet
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
That could be a tall order. Not all countries are made up in this manner.
For example, England is made up of 47 boroughs, 36 counties, 29 London boroughs, 12 cities and boroughs, 10 districts, 12 cities, and 3 royal boroughs.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|