|
|
Hello!
I have 2 forms. The first has a DataSet with a table("Table1"), the second form has a BindingSource, BindingNavigator, DataGridView;
<br />
Form1 fmMain=new Form1;<br />
Form2 fmSecond=new Form2();<br />
fm.ShowDialog(fmMain)<br />
private void Form2_Load(object sender, EventArgs e)<br />
{<br />
BindingSource.DataSource = ((Form1)this.Parent).DataSet;<br />
BindingSource.DataMember = "Table";<br />
DataGridView.DataSource=BindingSource;<br />
BindingNavigator.BindingSource=BindingSource;<br />
}<br />
BindingNavigator shows that there are 100 rows and the position=1, but DataGridView doesn't display anything.
But this code works:
<br />
Form1 fmMain=new Form1;<br />
Form2 fmSecond=new Form2();<br />
fm.ShowDialog(fmMain)<br />
private void Form2_Load(object sender, EventArgs e)<br />
{<br />
DataGridView dt = new DataGridView();<br />
BindingSource.DataSource = ((Form1)this.Parent).DataSet;<br />
BindingSource.DataMember = "Table";<br />
dt.DataSource=BindingSource;<br />
dt.Parent = this;<br />
BindingNavigator.BindingSource=BindingSource;<br />
}<br />
Does anybody have some ideeas?
|
|
|
|
|
at least can you see the column headers? Do you use AutoGenerateColumns = true , or defined columns?
Calin
|
|
|
|
|
I cannot see them, the DataGridView is empty.
Calin Tatar
Where have you found the property "AutoGenerateColumns"?, I couldn't find it.
|
|
|
|
|
AutoGenerateColumns is not browseable in propertygrid.
You may use it from code:
dataGridView.AutoGenerateColumns = true;
Calin
|
|
|
|
|
Hi i am using WebClient to upload some file to a server using the WebCLient.Uploadfile method
every time i try to run that method its throwing me a bad request error
The remote server returned an error: (400) Bad Request. is the exact exception message.
i dont know where am i doing wrong. everything seems to be ok
can anybody help me on this
i ll appreciate the Help.
Thanks,
Mamtha
|
|
|
|
|
|
Sorry Eliott
i couldnt really understand the article, seems like it actually trying to advertise their product
thanks,
Mamtha.
|
|
|
|
|
Something is wrong in your code with the way you are communicating with the web server is the summary. Or something is wrong with the web server, I assumed it was your code because, well, you didn't understand the article.
|
|
|
|
|
Yes, first thing that really comes up should be there is something wrong with my code.
the intresting thing is it is working fine when am running the method explicitly on a button click
and when i run it as a windows service, its throwing me the 400 error.
so this is what confusing me if there is something really wrong with my code then it should break on first attempt.
Thanks,
Mamtha
|
|
|
|
|
Yep, let me see here. Hrm I Just finished debugging your imaginary code, it appears the error is on line 46
while (1 == 2)
{
...
I can't guess here man, post something, if it is huge throw it in rafb.net/paste
|
|
|
|
|
yep here is the code part
try
{
WebClient webCl = new WebClient();
webCl.Headers.Add("Content-Type", "text/xml");
byte[] result = webCl.UploadFile("http://" + mgr.GetIniString("Server", "name", "localhost") + "/" + mgr.GetIniString("Server", "path", "localhost") + "/uploadFile.php", "POST", cachePath + "/" + TEMP_NAME);
string sresult = System.Text.Encoding.UTF8.GetString(result, 0, result.Length);
if (sresult == null)
{
log.Error("XML File could not be Read");
}
else
{
retVal = true;
}
}
catch (Exception ex)
{
log.Error(ex.Message.ToString());
}
finally {
File.Delete(cachePath + "/" + TEMP_NAME);
}
its actually throwing the 400 bad request at webcl.iploadfile method
|
|
|
|
|
if the problem is running as a service maybe its a security issue... of course this is just a suggestion as if i had a definative answer i would post that instead
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
yeah even i feel that it could have to do something to do with the security issue.
but am not really sure how to handle it
|
|
|
|
|
Crap... i just bout a 'CheckUpDown' account (DAMN ADVERTISING ARTICLES!!!)
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
Hi
I have one sealed Class. In this class I have created an object and set the values. Now I want to use these values in button click event. How can I achieve this.
public class General
{
private string _name;
private int _id;
public General()
{ }
public General(string Name,int ID)
{
_name = Name;
_id = ID;
}
public string GetName
{
get { return _name; }
}
public int GetID
{
get { return _id; }
}
}
Please note that there is no way to change sealed class.
|
|
|
|
|
sealed is not related to how the class is instantiated. sealed modifier just prevents the inheritance of the class.
use:
General general = new General("name",0);
Calin
|
|
|
|
|
could you try to describe your requirement more please.
From the code you have posted i cant see anything that would stop you accessing the properties
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
Thanks for all ...
Am developing application for ArcGIS dll. Bydefault the template is sealed class (no way to change) so I created one class that object created in sealed class. In the other from I have to use that information. The name and id belongs to Parcel owner name and id is Parcel unique ID. Please reply if you have any suggestions ...
|
|
|
|
|
The sealed keyword means the class is not inheritable. It has nothing to do with the classes mutability. If you have a sealed class (which, btw, your code example is NOT sealed...its a normal inheritable class), just create an instance and access the values. Problem nonexistent.
|
|
|
|
|
HI
I want to find the character position in a word.
for example,If the word contain 8 charcter, i want to print the 5th character in that word.
Thanx in advance.
|
|
|
|
|
string hello = "Hello";
char c = hello[4];
Kristian Sixhoej
"You can always become better." - Tiger Woods
modified on Monday, February 16, 2009 9:00 AM
|
|
|
|
|
IndexOutOfRangeException
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:10 AM
|
|
|
|
|
Uhm.. Is it zero-based?
EDIT: Obviously, it is. I must have been sleeping when I posted that code.
Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|