|
|
Hey howzit,
How can I create a textbox in runtime. for e.g. I just a button and then it creates a textbox on the form.
Can you please give me all the code i need, that would be a huge help!
Thanks
|
|
|
|
|
TextBox MyBox = new TextBox();
MyBox.Text = "Hi TextBox \n New Line";
MyBox.Multiline = true;
MyBox.Size = new Size ( 50, 60 );
MyBox.Location = new Point ( 20, 20 );
this.Controls.Add ( MyBox );
Ahmad Shaban
|
|
|
|
|
|
How do I bring the control to the front programmatically.
When the textbox is created, it appears behind the Panel instead of on top of it!
|
|
|
|
|
There's two ways
1) if you want to add the textbox to the panel
You replace the last line of code
this.Controls.Add ( MyBox );
with
MyPanel.Controls.Add ( MyBox );
2)use
MyBox.BringToFront();
please take a look at my program Startup Editor[^]
and rate my reply please 5 would be fine
Ahmad Shaban
-- modified at 6:57 Thursday 26th January, 2006
|
|
|
|
|
|
This is really cool. You could have a toolbar button that (when a registry item is selected) opens Regedit and goes to the key.
|
|
|
|
|
Can we achieve an child-parent lookup when we establish an object binding ?
Sorry i cant express it well so i'll give an example:
Let's suppose we have class Student and a class Classroom related in a way as follows.
class Classroom
{
public string Name {get;set;}
public string Code {get;set;}
}
We load from a db and get an Classroom[] { a , b , c , d}.
class Student
{
public string Name {get;set;}
public Classroom ClassRoom {get;set;}
}
We load students from a db.
Is this possible to bind Student.ClassRoom to a combobox which simultaneously be a lookup table deriving Classroom values from Classroom[] object i've already loaded and submit changes to the current student object of the binding source ?
I have done it with datasets so i assume it can be done with objects but project requirements exclude typed dataset and it's obligatory to use business objects.
It's not a homework , i'm not asking the code just a guideline or a decent data binding articles for .net 2.0 .
Thanx in advance.
|
|
|
|
|
How do I get what type of disc is in my cd/dvd drive?
I have been looking around in the WMI (Windows Management Instrumentation) and found Win32_PhysicalMedia and Win32_CDROMDrive but I don't know how to link them together or how to use Win32_PhysicalMedia to get the info of the discs in my drive.
Win32_PhysicalMedia.MediaType specifies the type of media (CD-R,DVD+RW,DVD-RAM etc.) but when I enumerate Win32_PhysicalMedia I only get info for my hard disks.
How do I do it? Is there an easier way than using WMI?
MajorPaul
|
|
|
|
|
WMI won't tell you what type of media is in the drive. It works with the drive itself and the POSSIBLE media's the drive can use.
You actually have to do low-level reading of the disk to deteremine what the media type is. But, I have no idea what to look for on the disk to determine its type.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks... I'll just have to skip that feature in my program then.
MajorPaul
|
|
|
|
|
Hi.
In C# (VS2003 and not VS2005) how can play sound?
I have a clock and it has alarm. I want to play a sound for alarm.
Best wishes
|
|
|
|
|
There are two third party component available for C#.you can use SAPI component .Search on sapi with C# and use it
|
|
|
|
|
hello my friend if you want to play sound when the alarm notifies you , you have first to create an event for your own second to interlop win32 function for playing sound files you can use that easily from directx but i will assume that you don't have directX namespaces so open your mind now and follow me in the code below
<br />
namespace yourprogram<br />
{<br />
..<br />
..<br />
..<br />
public void delegate mydelegate (object sender , EventArgs e);<br />
.<br />
.<br />
..<br />
public class yourprogram<br />
{<br />
private const int SND_filename = 0x00020000;<br />
private const int SND_Async = 0x0001;<br />
[DllImport("winmm.dll")]<br />
public static extern void PlaySound(string filename , int api_constant_1 , int Api_constant_2);<br />
....<br />
...<br />
..<br />
public event mydelegate myevent;<br />
<br />
myalarm.NotifyMe();<br />
myevent(this,new EventArgs());<br />
...<br />
...<br />
..<br />
Private void myeventmethod(object sender , EventArgs e)<br />
{<br />
PlaySound("your file path to .Wav File",0,D_filename | SND_Async);<br />
}<br />
myprogramclass.myevent += new myDelegate(myeventmethod);<br />
I hope this will do the work
Mess With The Best And Die Like The Rest
|
|
|
|
|
I implement my class like this
using System.Collections;<br />
using System.Collections.Generic;<br />
<br />
namespace TryCollection.PositionEngine<br />
{<br />
class Tag : IEnumerable<Point><br />
{<br />
<br />
#region Declare variables for internal use<br />
<br />
private List<Point> pointList = null;<br />
<br />
#endregion<br />
<br />
<br />
#region Declare variables for properties<br />
<br />
private string name;<br />
<br />
#endregion<br />
<br />
<br />
#region Constructors<br />
<br />
public Tag(string name)<br />
{<br />
this.name = name;<br />
<br />
pointList = new List<Point>();<br />
}<br />
<br />
#endregion<br />
<br />
<br />
#region Properties<br />
<br />
public string Name<br />
{<br />
get { return name; }<br />
}<br />
<br />
#endregion<br />
<br />
<br />
#region Methods<br />
<br />
public void Add(Point point)<br />
{<br />
pointList.Add(point);<br />
}<br />
<br />
<br />
public IEnumerator<Point> GetEnumerator()<br />
{<br />
return pointList.GetEnumerator();<br />
}<br />
<br />
#endregion<br />
<br />
}<br />
}
but when I compile it, it shows me an error that
'TryCollection.PositionEngine.Tag' does not implement interface member 'System.Collections.IEnumerable.GetEnumerator()'. 'TryCollection.PositionEngine.Tag.GetEnumerator()' is either static, not public, or has the wrong return type.
How can I implement System.Collections.IEnumerable.GetEnumerator() while I already have 'System.Collections.Generic.IEnumerable<trycollection.positionengine.point>.GetEnumerator()? Help me! Thanks!
I'm ...
a fan of Manchester United
a fan of Ozzy Osbourne
a King of Nothing
-- modified at 3:42 Thursday 26th January, 2006
|
|
|
|
|
Oop, I fixed it myself. Thanks anyway!
using System.Collections;<br />
using System.Collections.Generic;<br />
<br />
namespace TryCollection.PositionEngine<br />
{<br />
class Tag : IEnumerable<Point><br />
{<br />
<br />
#region Declare variables for internal use<br />
<br />
private List<Point> pointList = null;<br />
<br />
#endregion<br />
<br />
<br />
#region Declare variables for properties<br />
<br />
private string name;<br />
<br />
#endregion<br />
<br />
<br />
#region Constructors<br />
<br />
public Tag(string name)<br />
{<br />
this.name = name;<br />
<br />
pointList = new List<Point>();<br />
}<br />
<br />
#endregion<br />
<br />
<br />
#region Properties<br />
<br />
public string Name<br />
{<br />
get { return name; }<br />
}<br />
<br />
#endregion<br />
<br />
<br />
#region Methods<br />
<br />
public void Add(Point point)<br />
{<br />
pointList.Add(point);<br />
}<br />
<br />
<br />
public IEnumerator<Point> GetEnumerator()<br />
{<br />
return pointList.GetEnumerator();<br />
}<br />
<br />
IEnumerator IEnumerable.GetEnumerator()<br />
{<br />
return GetEnumerator();<br />
}<br />
<br />
#endregion<br />
<br />
}<br />
}<br />
I'm ...
a fan of Manchester United
a fan of Ozzy Osbourne
a King of Nothing
|
|
|
|
|
Hi
I am learning crystal reports. I am using VS 2003.
I have a question. Is there a way to use get the stored procedures when we connect to the databse. When i connect to the database, i can see all the tables and the views and not the stored procedures. When i am following the ADO.Net procedure by making the datasets, and when i am runnning the application, i am prompted for a login window for that stored procedure. Even if I give the right login and password, i am getting login failed and I get a blank report .
Did anybody come across such problem.
Can anybody help me with this issue.
Thanks a ton in advance
Shreya
|
|
|
|
|
|
Thanks a lot Muhamad.
I did exactly what you did. When I run the application, , when it is time to view the report, i am getting database login again, and when i enter the details, i am getting login failed , try again. I am not sure why i am getting it. i set the databaselogon details in the program.
Please let me know
Thanks Shreya
|
|
|
|
|
Sorry What exactly you want to know. May be I'm not getting you point. Can you explain in detail? As I think there may problem in you connection seting in Report or from SQL Side.
Let me also know.
Thanks and best regards,
Muhammad Waqas Butt
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
Hey howzit,
I am new to .NET, was a VB6 user. In VB6 one clicks on a control and then if you go to the code window, you can see a list of possible events associated with that control that one can use.
e.g. paint, terminate etc etc
In C# you only see the ones you create yourself, how do I get the list of all possible events? Or Do I need to go to MSDN everytime.
|
|
|
|
|
When you click on a contro, you can go to the properties wizard and click the "Events" tab. This is denoted by a yellow lightening bolt. In there you will see a list of all the events for that control.
Hope that helps
James
|
|
|
|
|
Shot thanks James, thats exactly what I wanted!
|
|
|
|
|
Hey Howzit,
In VS 2003 I used to just right click on the + next to the method in the code editor and say Collapse all or Expand all, in VS 2005 you can't do that.
Does anyone know how to?
|
|
|
|