|
Vasildb wrote: That project doesn't work because I have Visual Studio 2003
You should have mentioned it in your original post. Look at the code and get a general idea how to do the conversions or bump up to VS 2005...
|
|
|
|
|
Hope it's not too late!
private static Int32 BinStringToInt32(string value)
{
return Convert.ToInt32(value,2);
}
private static string Int32ToBinString(Int32 value)
{
return Convert.ToString(value,2).PadLeft(32,'0');
}
All the best,
Martin
|
|
|
|
|
I am working in C#.net and have a Datagrid control. The grid seems to work ok except for a new problem I have noticed.
When I resize the main form (and consequently the Datagrid) and scroll around the Datagrid using the forms scroll bars and then maximize the form and the Datagrid I notice that the Datagrid does not seem to repaint properly. The entire grid design is messed up.
I suspect this may be a repaint problem. Somehow and somewhere I need to force the grid to repaint.
I would appreciate any tips as to how and where I should do this.
Thanks, Vern
Vern
|
|
|
|
|
I can't really understand what your problem is, maybe you should be a little more clear on when the datagrid does not repaint itself correctly. As for HOW you can repaint it, datagrid.Invalidate(); should do the trick
Regards,
Vandra Akos
|
|
|
|
|
Vandra:
Thanks for the tip about the datagrid.Validate(). I put this in the Scroll event of the datagrid and this solved the problem I was having.
Let me try to explain the problem I was having again:
First I resize the datagrid so that the scroll bars show up. Then I scroll around the datagrid. Finally I resize the Datagrid so that it fills the screen. Now when I scroll again, the grid is messed up. Some columns appear twice, some don’t appear at all, its just really messed up.
Anyway, when I put the Datagrid.Invalidate() in the Scroll event, all is well.
Thanks again for your help.
Vern
Vern
|
|
|
|
|
i am trying to move a panel with:
pnlProgressBar.Location.X = pnlProgressBar.Location.X + 1;
for a progress bar. It is inside a while loop, but the following error occurs: "Cannot modify the return value of 'System.Windows.Control.Location' because it is not a variable"
I want it to later be able to actually show the amount of progress it has actually made, but first i need it to be able to move. If anybody else has a better way of making a progress bar that is only one bar, unlike the built in progress bar, please tell me. thanks in advance.
|
|
|
|
|
dsl/fahk wrote: Cannot modify the return value of 'System.Windows.Control.Location' because it is not a variable"
Location returns a Point structure. Point is immutable meaning once it has been created it cannot be changed. You have to assign a new Point to the Location property of the control.
|
|
|
|
|
Hello,
I would like to do what I call background printing. What this means is the user clicks a print button or a link to print a document without acutally having the document visible. I have searched the site for this and haven't found a posting covering this.
The only way I could think to make this happen would be to load the document in a hidden control and print from there. This seems kind of clunky and I was wondering if there was a more elegant approach.
Thanks in advance,
Eric
|
|
|
|
|
|
Why does this code give this error: "Specified cast is not valid"?
<br />
foreach(RadioButton r_button in groupBox2.Controls)<br />
{<br />
Console.WriteLine(r_button.Name.ToString());<br />
}<br />
|
|
|
|
|
Maybe you have something other than a RadioButton in groupBox2?
If so, try
foreach ( Control control in ... )
{
if ( control is RadioButton ) ...
}
|
|
|
|
|
Thanks!
This worked great!
<br />
RadioButton r_button = null;<br />
<br />
foreach(Control control in groupBox2.Controls)<br />
{<br />
if ( control is RadioButton )<br />
{<br />
r_button = ((RadioButton)control);<br />
Console.WriteLine(r_button.Text.ToString());<br />
}<br />
} <br />
|
|
|
|
|
|
Here's a more concise version that also performs better:
foreach(Control control in groupBox2.Controls)
{
RadioButton radioButtonControl = control as RadioButton;
if(radioButtonControl != null)
{
r_button = radioButton;
}
}
Last modified: 1hr 8mins after originally posted -- oops, meant to say != null there, thanks colin
|
|
|
|
|
The following line errors out.
<br />
RadioButton radioButtonControl = control as RadioButtonControl;<br />
I changed "RadioButtonControl" to RadioButton, but the if statement gives the following error.
Cannot implicitly convert type 'System.Type' to 'bool'
|
|
|
|
|
The if statement must evaluate to a boolean. The code you were given shows a mistake many developers that code in both C++ and C# make.
if (radioButtonControl != null)...
|
|
|
|
|
I don't know why I didn't know that, I use that all the time!
|
|
|
|
|
Colin Angus Mackay wrote: a mistake many developers that code in both C++ and C# make.
fixed
|
|
|
|
|
Hello friends!
I want to see source code of a simple accountancy or inventory software(that is written by C#.NET),
Do you know how can I find that?
Thanks
|
|
|
|
|
I want to see BigFoot. I think we both have the same chance.
|
|
|
|
|
bigfoot
as for the C# code you have a much chance of seeing Britney's left boobie.
(crosses fingers and hopes for a reply :P)
i'm sorry i just couldn't help myself
|
|
|
|
|
ad3z wrote: bigfoot
|
|
|
|
|
your best bet would be to try Source Forge or something like that
|
|
|
|
|
Hi,
I have a web service method call RegisterMember() that takes some inputs from the client app. do some processing and then send the result to an external url (http://someexternalurl/RegisterMember.aspx), which would registered the member on their database.
I am using HttpWebRequest to POST the data to the external url. I set up a test environment and run my web service. The result "The member has been registered" is returned to the client app. but nothing happens on the POST request. That is, no record were inserted into the database. Is my syntax for HttpWebRequest correct? Is there a security setting on the Web Service? If I were to invoke the url (http://localhost/test/RegisterMember.aspx?fname=test&lname=test) directly, the record get created so I don't think that is the problem.
My code for the web service is shown below:
<pre>
[WebMethod]
public string RegisterMember(string fname, string lname)
{
//process the data here ...
//POST data to external url
string cSeparator = "&";
ASCIIEncoding encoding = new ASCIIEncoding();
string cPostData = "Fname="+ fname + cSeparator + "Lname=" + lname;
byte[] data = encoding.GetBytes(cPostData);
// Prepare web request...
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost/test/RegisterMember.aspx");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();
//returns to client app
return ("The member has been registered");
}
</pre>
Thanks,
Khuan
|
|
|
|
|
hi all,
one more question concerning dataGrids.
How can i resize the table contained in the dataGrid so that it fills the dataGrid till it borders only. I mean to fit in the width not height.
i need it programmaticaly
thanks in advance,
Help me cz i will help you when you need
|
|
|
|