|
adf.Text , not asdf.text .
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
well, actually I have this on controls.cs...
Form1 asdf = new Form1();
asdf.Text="RESPECT THE ENG";
now... the question i guess...
on Form1, how do I call this?
/\ |_ E X E GG
|
|
|
|
|
Form1 isn't an object. It's a class. asdf is an object (instance of a class). You need to change the text on asdf, not on Form1 and you can't do that unless you have a reference to asdf.
You might need to enumerate all the forms until you find the one you want or you could pass a reference of the form to control.cs so that you can manipulate it later.
|
|
|
|
|
try passing the form on the constructor of the control.cs object, and store this in the control object. i.e.
<br />
private Form form1;<br />
<br />
public Control(Form form)<br />
{<br />
this.form1 = form;<br />
}<br />
You should then be able to make calls like form1.Text = "whatever". If that doesn't work quite try public Control(ref Form form).
|
|
|
|
|
Anyway, which ever spelling you prefer is up to you. I just want to know this, how do you convert RGB values to hex values?
|
|
|
|
|
If you are wanting the web format (#RRGGBB), use ColorTranslator.ToHtml. Otherwise, use the Color.R, Color.G, and Color.B properties, and convert them to hex using Int32.ToString("xx").
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Hi,
I have a MDI application, which has a workspace (a form) and a tool bar window. User can create new forms and place controls from the tool bar onto this forms. They should be able to move controls on this form.
Here is the problem:
To let user move controls around on the form, I handle the MouseDown, MouseMove and MouseUp events for the selected control. In the MouseMove event handler I compute (using the location value saved in Mouse Down event) the new location for the control and set it as the location of the control. This somehow cause more mouse move events on the control - this is because, I think, the assignment of new value to the location property cause the control to move to the new location while it has the mouse pointer on it. This may generate new mouse move events!!!
Any suggestions / solutions to avoid the extra mouse move events would be highly appreciated.
Thanks,
Suhas
|
|
|
|
|
as long as the mouse moves, there will be mousemove events, try keeping track of when a control is being moved, using a boolean variable, and if its not being moved, then dont run all hte code in your MouseMove.
Another Post by NnamdiOnyeyiri l Website
|
|
|
|
|
I am sorry I do not understand your suggestion.
The control does not move on its own, it moves in response to mouse move events.
Even when the mouse has stopped moving the control continues to receive mouse move events because the control itself is moving in response to the previous mouse move events. I suspect that this extra mouse move events are generated because the control the has mouse pointer on it when it is moving.
The pseudo code is:
MyMouseMoveHandler()
{
// Compute the move distance
// Move the control - this itself it generating more mouse move events
// even though the mouse has stopped moving.
}
Thanks,
Suhas
|
|
|
|
|
try setting handled to true and that might stop the flow of events
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
1. When you click a row on the far left, it highlights the entire row.
is there a way to do this with a DataGrid method?
2. I would also like to tab down rows instead of across cells. I see where you can capture the tab change, but i don't know how to focus on a row ( relating to my first question )
any insight would be much appreciated. c# is great!
|
|
|
|
|
this.dataGrid1.Select(this.dataGrid1.CurrentRowIndex);
i thought i knew how to capture the tab change, but it doesn't work as expected.
is there a way to capture tab within the data grid? then i can use the code above to focus on the next row down.
|
|
|
|
|
sink the keydown event then use your above code
protected override bool ProcessKeyPreview( ref System.Windows.Forms.Message m)
{
Keys keyCode = (Keys)(int)m.WParam & Keys.KeyCode;
if((m.Msg == WM_KEYDOWN || m.Msg == WM_KEYUP) && keyCode == Keys.Tab)
{
dg1.Select(dg1.CurrentRowIndex++);
MessageBox.Show("Hey");
return true;
}
else
return true;
}
theres the code to override the key event but the problem is for checkbox columns it will work.
But for other columns YOU MUST extend the DataGridTextBoxColumn class and provide your own event handling inside.
CHeck this link:
Dude the everything I ever wanted to know about DatraGrids
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
the first should return false sorry.
But I would inherit the grid and extend the OnCurrentCellChange method ( I think thats the name, but its real close.) in that create a delegate and raise an event cell change or inside force a new row instead of a new column.
thats would be easier or create your own extended columns thier both fast an easy.
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
I want to return my defined class from my XML Services. In the test page there is no probem and it display page correctly,but in my windows appplication there is problem. When in my windows application I want to return my class from my xmlservice function I got compiler error:
Can not imlpictly convert from localhost.webservicenamespace.myclassname to Myclassnamespace.myclassname
So I change it to localhost.webservicenamespace.myclassname but now here I get null object. Should I do anything special for getting custom types from XML web services? Any idea?
Mazy
No sig. available now.
|
|
|
|
|
|
Hi Nish:
The problem was that I have to connect to internet when I want to use my web service,but it works on ASP.NET without connecting to internet.
I want to post this last night but it might it was a problemm with CP database.Any way,thanks.
Mazy
No sig. available now.
|
|
|
|
|
has anyone programmed a bot for MSN using c#?
im trying to make one myself. so i need to check out some samples.
im also new to c# programming but i'll get along well.
i found dotMSN library. but the sample that came along didnt compile. so i need to see some others before i get going on my own.
can anyone help ?
|
|
|
|
|
I have a method (name=HelloCSharp.Rand(), see below "QUESTION HERE") that's uses "uint" as parameter and return type - therefore not CLS-complaint and I was expecting a compiler error. Problem is, there was NOT a compiler error (or error of any kind)... THanks.
namespace SomenameSpace
{
using System;
public class NukeIt
{
public NukeIt(){ }
//NO PROBLEM HERE: This method NOT CLS-compliant and generated a compiler warning as expected.
public uint Rand(uint nSeed) {return nSeed;}
}
class HelloCSharp : HelloVB
{
public HelloCSharp()
{
}
public override void Hello()
{
base.Hello();
Console.WriteLine("Hello, C#");
}
public new int Add(int val1, int val2)
{
return val1+val2;
}
//QUESTION HERE: "uint" is NOT CLS-compliant and should generate a compiler warning, but, it did NOT??
public uint Rand(uint nSeed)
{
return nSeed;
}
[STAThread]
static void Main(string[] args)
{
HelloCSharp hello = new HelloCSharp();
hello.Hello();
}
}
}
Thanks!
norm
|
|
|
|
|
|
|
if your code is cls compliant, it means that ANY .NET language can run your code, but if it is not CLS complint, i.e. uses features only available in C#, then only C# applications can run your code.
Another Post by NnamdiOnyeyiri l Website
|
|
|
|
|
I can populate a dataset and create a datagrid, but now it is time to do something with it.
I have a datagrid which shows a list of contacts. I want to be able to click on a row and have it execute a method. ( open a new form to edit the contact )
Are there any tutorials, or quick times one could advise?
Thanks!
|
|
|
|
|
|
Thank You, that is a great reference.
This question is related. I can get the CurrentRowIndex, but I would like to get a value of one of the cells instead.
<br />
txtCustomerID.Text=this.dataGrid1.CurrentRowIndex.ToString;<br />
I would like the text box "txtCustomerId.Text" to reflect colume "CustomerID" in dataGrid1
|
|
|
|