|
Hi all,
How do i know that there is some row exist in the grid or not ...
i have to test a condition like
if(this.abcgridview.CurrentRow.selected)
{
// do something
}
am calling this condition from two different places
in first case grid has some rows..that time no problem am able to execute my task
but in second one i dont have anyvalue in the grid that time it is throwing me error message ...
like "Object reference not set to an instance of an object".
can you please help me here ...
Thank you..
vikas da
|
|
|
|
|
if(dataGridView1.Rows[0].Cells[0].Value.GetType() == typeof(DBNull))
{
}
|
|
|
|
|
Thank for ur reply its done ...
if (this.abcDataGridView.CurrentRow == null)
{
//some message
return ;
}
i am trying with ur code now ..
vikas da
|
|
|
|
|
hi,
how can i get the data from i list and then put such data in textbox,
like that
DomainContext objContext = new DomainContext(new ManageInstitute());<br />
objContext.AddField(EntityMapper.School.SCHOOLID,8);<br />
IList objList= objContext.Load(EntityMapper.Entities.SCHOOL, DomainMapper.GET_SCHOOL_BY_ID);
then how can i put the data in "textbox" from "objlist"
textbox.Text=objlist??????
|
|
|
|
|
IList implements IEnumerable . So you can use foreach to iterate the collection and set necessary values to textbox.
foreach(object obj in objList)
{
textbox.Text = obj.ToString();
}
|
|
|
|
|
Hi everyone
I'm writing a web application which has a button called 'go', when it's clicked it takes long to execute, so I want to play a flash file while it's being executed, so I want to call two methods playflash function(written in javascript in the header of aspx file) and run(written with c# placed in the aspx.cs file), when this button is clicked how should I do this? I tried the following code but it didn't work onButtonClicked="playflash();run();"
Please help me.
|
|
|
|
|
You can use some AJAX calls to do this. Look at the AJAX toolkit.
|
|
|
|
|
Instead of onButtonClick, use onClientClick.
|
|
|
|
|
How to display thumbnail image in listview controller.
there are three type files in listview.
1,normal files : display system thumbnail.
2,image files : display image thumbnail.
how to do?
if you can provide the project ,very thank you!
|
|
|
|
|
I can supply you with my code which is downloaded from www.codeproject.com. I hope that you can get some information from my code.
|
|
|
|
|
I am executing a query
ObjectQuery query = new ObjectQuery("Select TimeWritten from Win32_NTLogEvent Where LogFile='Application' ");
it gives, Timewritten= 20080715091712.000000+330 which format of dateTime is it.
how could i compare it with DateTime having format mm/dd/yyyy HH:MM:SS, as i compare it with it gives error.
Regards
|
|
|
|
|
I think you must write your own method to compare it.
|
|
|
|
|
Hello,
I am using http to get a request from a server. The server has been setup to receive a customer ID and return the balance.
However, I am getting an error message with the code I am using below: "Invalid URI: The URI scheme is not valid."
From what I can make out by using wireshark is that the server expects a customerID and the balance will be returned. I am not sure that the data is another parameter that the server expects.
So how can I write the URL that expects a parameter like the customer ID?
Many thanks for any extra help,
<br />
private void btnGetBalance_Click(object sender, EventArgs e) <br />
{ <br />
try <br />
{ <br />
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("000.000.00.00:8080/billing/servlet/comm.billing.GetBalance?Date=17:54:24&CustomerID=8057"); <br />
HttpWebResponse res = (HttpWebResponse)wr.GetResponse(); <br />
StreamReader sr = new StreamReader(res.GetResponseStream()); <br />
string balance = sr.ReadToEnd(); <br />
} <br />
catch(UriFormatException ex) <br />
{ <br />
MessageBox.Show(ex.Message); <br />
} <br />
catch(Exception ex) <br />
{ <br />
MessageBox.Show(ex.Message); <br />
} <br />
} <br />
|
|
|
|
|
Problem solved.
I missed of the http://
|
|
|
|
|
Subtle, but it happens
|
|
|
|
|
Hi.
I'm currently creating a game that contains a lot of characters. I'm now facing the problem of getting a very high complexity in my application because of the high number of characters.
I wanted to make a CharacterHandler that creates instances of the characters (Need to be a factory patteren of a kind, character creations need to take game difficulty into accound etc.)
this is some code from a character:
public class Bananas : NormalBrush, ILevelObject, IPointObject
{
private readonly int _collisionGroup;
private readonly float _mass;
private Body _body;
private Geom _geom;
public Bananas(Vector2 position, int collisionGroup, float mass, float scale, ContentManager contentManager)
: base(Color.White, position, contentManager.Load<texture2d>("Content/Objects/Fruits/Bananas"))
{
_collisionGroup = collisionGroup;
_mass = mass;
base.Scale = scale;
}
}
Is there a way that i can change the inheritance of the objects to simplify the creation of the characters or maybe use C# generics to do the job?
Any improvements are welcome.
EDIT: To sum it up.
Instead of doing:
CharacterHandler.CreateBananas(position);
CharacterHandler.CreateOrange(position);
CharacterHandler.CreateApple(position);
I could do something like this:
CharacterHandler<bananas>.CreateCharacter(position);
and so on.
|
|
|
|
|
Hi,
I have a usercontrol inside a form.
The form has one toolStripButton.
I want change toolStripButton visibility from the usercontrol.
How can i do that?
I don´t want to open a new form!!!
In Form_Main:
public bool _visibility_form
{
set { ToolStripLabel_Username.Visible = value; }
}
In UserControl_Login:
private void button1_Click(object sender, EventArgs e)
{
Form_Main frm = new Form_Main();
frm._visibility_form = _visibility_usercontrol;
frm.Show();
}
bool visibilty = false;
public bool _visibility_usercontrol
{
get { return visibilty; }
}
|
|
|
|
|
You will need to give the UserControl a reference to the Form that contains it. You could then set that reference in the Form loaded event and use it in the button click handler.
|
|
|
|
|
Think about how any other control you have on your form call methods in your form... they raise events that you listen for. So, create an event / delegate in your user control then you can subscribe to it in your form and react accordingly.
Dave
|
|
|
|
|
Hi,
I am new to C# and currently using C# 2.0. I have
public struct event
{
public static int w_hr;
}
public struct day
{
public static event mon;
}
can I access day.mon.w_hr = 5; How do I accomplish this.
Thanks.
|
|
|
|
|
To start with, you probably don't want to call it "event" it is a reseved word. If you use the notation that all class and struct names are Pascal cased (the start of each word in the name starts with a capital letter) then you won't have a problem there.
brigates wrote: can I access day.mon.w_hr = 5; How do I accomplish this.
Other than the fact you are using a reserved word, that should otherwise work fine.
Sorry - I missed the fact that w_hr is also static. See Guffa's response. It is correct.
modified on Tuesday, July 15, 2008 7:53 PM
|
|
|
|
|
brigates wrote: can I access day.mon.w_hr = 5; How do I accomplish this.
No, you can't access it that way.
The w_hr property can only be accessed using event.w_hr as it is a static member.
brigates wrote: I am new to C#
Then you should not use structs, as they are trickier to implement correctly. Use classes.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I have a struct that holds a value up to UInt64 . Depending on the value it could potentially be held in another Type .
I've got a function that whos return value is Type , which is the minimum required to hold the value.
From this returned Type , how do I create an object of that Type?
Dave
|
|
|
|
|
Have a look in the System.Reflection namespace for Activator (I think)
|
|
|
|
|
System.Activator Hmm... a little work to do to figure this one out!
Thanks Colin
Dave
|
|
|
|