|
Another way: You can make this an overloaded method or create two properties.
public string SmallWindowPrompt( int smallWindowNumber ) {
return this.SM[sallWindowNumber];
}
public void SmallWindowPrompt( int smallWindowNumber, string vData ) {
SM[smallWindowNumber] = vData;
}
public string GetSmallWindowPrompt {
get { return this.SM[SmallWindowNumber];}
}
public string SetSmallWindowPrompt {
set{ this.SM[SmallWindowNumber] = value;}
}
|
|
|
|
|
Question #3
The dividion operator is overloaded to handle both integer and floating-point division.
Search for "Operators Compared in Different Languages" in the Help topics.
cast the results to integer.
float i = 1199282.293F;
float j = 199.33F;
newResult = (int)( i / j );
|
|
|
|
|
I have created a .dll file to manage data with an sql server.
I want to build a new windows app that uses that .dll
2 Questions:
1. Where does the .dll file go? In the same directory as my project?
2. When I include the file, is it just like I define other classes?
Using namespace.class;
|
|
|
|
|
Assuming you are using Visual Studio.NET, open the solution explorer and right click on the "references" folder, select the "Add reference" menu choice, then click the browse button. Browse to your .DLL file, and click "OK". That will add a reference to your .DLL to the project. From there, just add a line at the top of your source file like this:
"using mynamespace;"
Martin Cook
Who needs cyberspace when you have CP space?
|
|
|
|
|
Thank you , .. as for .NET classes, they should automatically reference .. is this correct?
I had a problem where I created an app that would not run on another system which didn't have VS.NET installed.
It was an XP Pro box with .NET1.1 installed.
|
|
|
|
|
I had a problem where I created an app that would not run on another system which didn't have VS.NET installed.
As long as the target machine has the .NET framework installed, you should be good to go. Ensure that the framework version on the target machine is the same as the one you compiled your application to.
|
|
|
|
|
Hey,
How do you hide a form on startup so that it doesn't show at all. I want to hide a form initially until the user clicks on a notifyIcon. Currently...
public Form1()
{
InitializeComponent();
this.Hide();
}
...does not work. Any suggestions?
-- Adam
"If you can't beat your computer in chess, try kickboxing"
|
|
|
|
|
Hey Adam,
try this, to prevent the form to be created at startup, if the no-button is clicked.
if (MessageBox.Show("Start Application",
"Question",
MessageBoxButtons.YesNo,
MessageBoxIcon.Information) == DialogResult.Yes)
{
Application.Run(new Form1());
}
Maybe it's helpful...
Jörg
|
|
|
|
|
why not set a madule main function to be startup rather than a form. then you can do what you want with it
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Okay,
I've got a semi working solution, tell me if i'm doing anything that could lead to problems later.
public class Class1
{
static void Main()
{
Form1 form = new Form1();
Application.Run();
}
}
public class Form1 : System.Windows.Form
{
public Form1()
{
IntiallizeComponent();
this.Visible = false;
}
}
This creates the notifyIcon in the system tray, but does not show the form. When the notifyIcon is double clicked, then the form pops up. When the form is disposed, i have it call Application.Exit() so that the Application quits properly...this is mostly what i'm concerned about, that the tread is terminating properly.
-- Adam
"If you can't beat your computer in chess, try kickboxing"
|
|
|
|
|
I have a window with AutoScroll set to true, but I seem to have some odd problem wtih it.
Whenever the window gets focus, the scrollbars jump to 0. How can I fix this?
|
|
|
|
|
There is a property called AutoScrollPosition which contains the offset of the scrollwindow. I guess you have to manually account for this all the time...
But I really don't know cause I have the same problem.
If you find a good solution please let me know...
|
|
|
|
|
Hi guys !
Is there a way to know on which column of a ListView control the user has clicked ?
We can now the row but not the column.
Any idea ?
Thanks.
|
|
|
|
|
aeros,
you can do it through OnMouseDown (or OnMouseUp). That events have MouseEventArgs parameters X, Y which you can use in ListView GetItemAt method. GetItemAt gives you the clicked ListViewItem. And thanks to Index property you can obtain the column.
Hope it helped.
Tomas Rampas
------------------------------
gedas CR s.r.o.
System analyst, MCP
TGM 840,
293 01 Mlada Boleslav,
Czech Republic
Telefon/phone +420(326)711411
Telefax/fax +420(326)711420
rampas@gedas.cz
http://www.gedas.com/
------------------------------
|
|
|
|
|
Hi,
It doesn't work because ListViewItem.Index property gives you the row not the column.
--
Regards,
Julian.
|
|
|
|
|
 You are right. We have to help ourselves with interop:
class YourClassName<br />
{<br />
const int LVM_FIRST = 0x1000;<br />
const int LVM_GETSUBITEMRECT = (LVM_FIRST + 56);<br />
const int LVIR_BOUNDS = 0;<br />
const int LVIR_ICON = 1;<br />
<br />
[StructLayout(LayoutKind.Sequential)]<br />
struct RECT<br />
{<br />
public int left;<br />
public int top;<br />
public int right;<br />
public int bottom;<br />
};<br />
[DllImport("user32.dll")]<br />
private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, ref RECT lParam );<br />
<br />
private void listView1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
RECT myrect;<br />
ListViewItem lvitem = listView1.FocusedItem;<br />
int wParam = lvitem.Index;<br />
int intLVSubItemIndex;<br />
ListViewItem.ListViewSubItem LVSubItem = null;<br />
int intSendMessage;<br />
<br />
for( intLVSubItemIndex = 1; intLVSubItemIndex < lvitem.SubItems.Count; intLVSubItemIndex++)<br />
{<br />
LVSubItem = lvitem.SubItems[intLVSubItemIndex];<br />
myrect = new RECT();<br />
myrect.top = intLVSubItemIndex;<br />
myrect.left = LVIR_BOUNDS;<br />
intSendMessage = SendMessage(listView1.Handle, LVM_GETSUBITEMRECT, wParam, ref myrect);<br />
if( e.X < myrect.left)<br />
{<br />
LVSubItem = lvitem.SubItems[0];<br />
intLVSubItemIndex = 0;<br />
break;<br />
}<br />
else if(e.X >= myrect.left && e.X <= myrect.right)<br />
{<br />
break;<br />
}<br />
else<br />
LVSubItem = null;<br />
}<br />
<br />
if (LVSubItem != null && lvitem != null)<br />
{<br />
MessageBox.Show(String.Format("ColumnIndex: {0} {1}", intLVSubItemIndex,<br />
LVSubItem.Text));<br />
}<br />
<br />
<br />
}<br />
}<br />
In the intLVSubItemIndex you have 0 base index of clicked column.
Tomas Rampas
------------------------------
gedas CR s.r.o.
System analyst, MCP
TGM 840,
293 01 Mlada Boleslav,
Czech Republic
Telefon/phone +420(326)711411
Telefax/fax +420(326)711420
rampas@gedas.cz
http://www.gedas.com/
------------------------------
To be or not to be is true...
George Bool
|
|
|
|
|
I have a little problem...
I have a panel with controls on it, that i want to draw to the printer. the controls consist of smaller panels with text inside them, and listboxes with lines of text inside as well.
(class diagram editor)
Now the problem is that when I print this i scale it to fit to A4 (or whatever specified) paper size. No problem scaling a simple bounding rectangle to the textboxes and listboxes, but now I want the text to be printed inside these components as well, so the print-out will appear as on screen. How can i fit the text into these boxes, i.e. apply a scaling to the bounding rectangle of the text?
I have thought of two things:
Either change font size until something that fits is found
OR
Draw the text to a bitmap and scale this.
Is there any 'standard' way of doing things like this? Any suggestions?
|
|
|
|
|
I want to change that ListView.ListViewItem's height.
HOW TO ?????
help!!!
|
|
|
|
|
I think you would have override OnPaint method and draw the item for yourself.
Tom.
Tomas Rampas
------------------------------
gedas CR s.r.o.
System analyst, MCP
TGM 840,
293 01 Mlada Boleslav,
Czech Republic
Telefon/phone +420(326)711411
Telefax/fax +420(326)711420
rampas@gedas.cz
http://www.gedas.com/
------------------------------
|
|
|
|
|
Hi all,
does somebody know, how to convert an initialized string into an executeable expression.
Like:
string Form = "Form1.text" + "=" + "Hello";
This string should now be executed directly, instead of
doing
Form1.text = "Hello";
Background is to rename buttons and forms....
Would be very helpful if somebody has a
great Idea.
Thanks
Jörg
|
|
|
|
|
I would use the MS Script Control. I think there's some help on it in the IDE help files
Nick Seng (the programmer formerly known as Notorious SMC)
God, I pity me! - Phoncible P. Bone
|
|
|
|
|
How can I access the functions of a COM object located in a windows service?
The windows service was written under Visual C++ 6.0.
-Alma-
|
|
|
|
|
I have done it in the following way:
1. registered the service: MyService.exe /service
2. added the associated type lib to the project:
using MyServiceLib;
(I used the Add reference wizard: Solution explorer tab, right click on the solution name, click on Add reference..., click on COM tab, in the appearing list box select the needed type library)
3. Created an object:
IMyObject newObject = new MyServiceLib.MyObjectClass();
4. Called the objects methods:
newObject.Function(param1, param2);
-Alma-
|
|
|
|
|
Hi there!
I've made a UserContol for my app. for modifing records in my form! SO i have new, delete & ... buttons in my UserControl but I wanna fire the AddRecord, DeleteRecord & ... functions from my Form! I mean functions are in my form but I want to fire them by clicking UserContol buttons.
How can I do this?!
Any help appreciated!
Always, Hovik.
(forgive my English)
|
|
|
|
|
Hello,
you can Add an custom events and delegates to your UserControl which will be trigged when user clicks button in your UserControl. In your Form you can register delegate method for the UserControl event which will be responsible for event processing.
T.
|
|
|
|