|
thankyou all for your helpful comments! :P
will check out what you have said...
-------------------------------------------------------
ithium is the best.
'Science without religion is lame, religion without science is blind.' --Albert Einstein
'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein
|
|
|
|
|
Check out Windows Forms Programming in C# by Chris Sells.
Kuphryn
|
|
|
|
|
thankyou. looks quite cool...
-------------------------------------------------------
ithium is the best.
'Science without religion is lame, religion without science is blind.' --Albert Einstein
'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein
|
|
|
|
|
microsoft press has copule really good ones.
probably the best book about windows forms and graphcis (GDI+)
Programming Microsoft Windows with C# by Charles Petzold
pretty thick with about 1200 pages. You can use it as a reference and to just read about things.
http://www.amazon.com/exec/obidos/tg/detail/-/0735613702/qid=1086702102/sr=1-4/ref=sr_1_4/104-9011139-0631159?v=glance&s=books
and a really good bood about .net framework:
Applied Microsoft .NET Framework Programming by Jeffrey Richter
http://www.amazon.com/exec/obidos/tg/detail/-/0735614229/qid=1086701997/sr=1-1/ref=sr_1_1/104-9011139-0631159?v=glance&s=books
|
|
|
|
|
thankyou, will check out.
-------------------------------------------------------
ithium is the best.
'Science without religion is lame, religion without science is blind.' --Albert Einstein
'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein
|
|
|
|
|
Hi guys. I may have a stupid question. I'm a bit of a newbie to C#. So, to get into things I'm building a CD player. Now, I know there's a tutorial here. But before I dive into the MCI, I had a question about the WMP.dll. Would it be easier and simpler to use that? Can I use that? How do I use that? For example, in the tutorials home made .dll he has to use the MCI to eject the CD rom.
In the wmp there's a method for doing so called "player.cdromCollection.item(index).eject()". Now, how would I clal that method. And from my understanding, I have to in a sense 'install' the player into my app. I just want a button that says "eject" and calls this method. Just to experiemtn with, not the whole media player with media window and play and stop buttons. Is this possible? For example, can I use Environment to find the CD Drive and it's path and then from there eject the cd? Or better yet create a CD Rom Object and use driveSpecifier?
Again I'm new to this, so help me out if you can. It would be just easier for a newbie lke myself to use these commands already in wmp.dll by importing that library then necessarily messing with the MCI.
Thanks for reading and hopefully answering.
|
|
|
|
|
Yes, it's possible, but then you're not really writing a CD-ROM player, are you? Besides, if you're new, you should really start out with something a little more basic.
To include the Windows Media Player into your Windows Forms application, customize your toolbox in VS.NET. Click the COM tab and find the Windows Media Player control and add it to your toolbox. Then simply drag and drop that onto a container control (like a Form or UserControl ) and two interop assemblies (a.k.a. Runtime Callable Wrappers) are created - one for the ActiveX control, and one for the WMP typelib. Then add your Eject button, for example, and call the method on your player control, which is declared as a variable.
To note, if you're going to strongly name your assembly (and it's always a good idea to, especially if you need to install it into the Global Assembly Cache (GAC) or do anything decent with versioning assemblies) you should right-click on your project and select Properties. Find the assembly key filename and pass the filename (path relative to the project, or an absolute path) of a key pair you generated with sn.exe -k KeyFile.snk (any filename will do). When the interop assemblies are created, they are created with strong names as well. A strong name assembly can only reference other strong named assemblies, though non-strongly named assemblies can reference strongly named assemblies.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have see the EnsureVisible Method of both TreeView, and TreeViewItem. I want to just check if the item is visible or not, I don't neccessarily want to force it to be visible. I've also see TopItem, but I'd reather be able to check the visibility of any item in the control. I imagine I could use GetItemBounds to get the height of each Item then do some math to see if the control's height is large enough to show the specific Item in question, but I didn't know if there was a built in Property or function that would be better to use ?
Thanks for any thoughts you may have.
|
|
|
|
|
You didn't see TreeNode.IsVisible when looking at all those properties?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Wow,big Typo there I meant to say ListView not TreeView...sorry about that.
|
|
|
|
|
Then either use ListView.GetItemRect or ListViewItem.Bounds (or ListViewItem.GetBounds , but used in the same way) and determine if the returned Rectangle.Y is greater than the ListView.Bottom .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
OK, I kinda figured those would be my options, thanks Heath....
|
|
|
|
|
I need to upload from exel doc every day 20 rows of 5 input fields into my company's web site to an aspx page into asp:textbox components and send to server via send butoon in a loop(20 times). anyone please point me to code for doing that anyway in c#.
10x
|
|
|
|
|
Simple: write an application that uses a timer, read-ins the Excel spreadsheet using an interop library (add a reference to Microsoft Excel to your project), and POST the data (see the HttpWebRequest and HttpWebResponse classes) to your ASP.NET application.
If you want help with something specific, then ask about something specific. This forum is intended to help you with programming question, not really to help you design an application.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi!
I have a try-catch-finally block, the catch declares some Exception e, but I don't need this e... Now if I compile this I get an unreferenced variable warning...
How to avoid this, unreferenced variable warnings?
Best regards and thanks in advance,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
try
{
... some code that might fail...
}
catch
{
... code for handling ALL exceptions ...
}
Note: There is nothing after the catch statement! No unreferenced variables...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
try{ ... some code that might fail...}catch{ ... code for handling ALL exceptions ...}
AFAIK an empty catch catches nothing! But to answer the original q.
try { } catch (Exception) { }
top secret xacc-ide 0.0.1
|
|
|
|
|
True, but that's pretty pointless in reference to what Dave wrote. This type of declaration works best when you want to catch specific exceptions (besides the base Exception class), whether or not you declare an exception variable (I know you know that, leppie, I'm just explaining it to the poster if he manages to read it).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Actually, it will catch the Exception. Try it...
try
{
System.IO.Directory.SetCurrentDirectory(@"Z:\testme");
}
catch
{
MessageBox.Show(@"Exception caught!");
}
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I think I know why I thought that.
Was running a console app, and waiting for some output in the VS.NET Output console.
~leppie()
top secret xacc-ide 0.0.1
|
|
|
|
|
Hi All,
Just a simple question. I am trying to add the data in a access database (file residing on local machine.) I saw the format and worked according to it. Here is the code.
Console.WriteLine(CBoxCatagory.SelectedItem.ToString());
String sSql = "INSERT INTO MainCatagory" + "(MainCatagory)" + "VALUES("+CBoxCatagory.SelectedText+")" ;
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +@"Data source= C:\" + @"My Documents\db1.mdb";
conn.Open();
OleDbCommand objCommandMain = new OleDbCommand(sSql,conn);
objCommandMain.ExecuteNonQuery();
When I use the fixed or hard data in Values then statement executes fine. But when I am trying to execute with a variable of type ComboBox then it is giving me error. I also tried to use a simple string variable and see the result and it was same. Seems like there is problem in the syntax for adding values using variables.
Here is the error.
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
Can you suggest me something on this one.
Thanks,
|
|
|
|
|
OK, the first thing I notice is that you're doing a lot of unnecessary string concatenation. The second thing I see is that your CBoxCatagory.SelectedText value is not surrounded in quotes, for the sake of SQL. Try this:
tring sSql = "INSERT INTO MainCatagory (MainCatagory) VALUES('" + CBoxCatagory.SelectedText + "')";<br />
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source=C:\My Documents\db1.mdb";<br />
...
Regards,
Alvaro
Give a man a fish, he owes you one fish. Teach a man to fish, you give up your monopoly on fisheries.
|
|
|
|
|
I tried that but it did not work. Then I replaced CBoxCatagory.SelectedText with fix text as Onemore.
It worked fine.
One more thing i observed with my database is that Table Maincatagory has 2 colums. One is maincatagory and other AutoIncrement. When I try to execute the statement with CBox it fails but it increses the AutoIncrement count.
Now does this mean that script is failing in database at insert point bcoz data coming in has wrong format. But I think the format is text so it should not fail anyways.
Any suggestions.
|
|
|
|
|
The SelectedText property of a ComboBox is the selected text in the editable portion of the box. In some cases, SelectedText can return null , especially if your ComboBox is setup with its DropDownStyle set to ComboBoxStyle.DropDownList . Use SelectedItem.ToString() instead.
This could have been easier to diagnose had you been using parameterized queries instead of string concantenations...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I tried that too!
In Fact, I also tried something like this.
String firstString = "ABCCD";
and then used this firstString Var in place of ComboBox var.
Thanks,
|
|
|
|