|
Hi Everybody
I have a question I wish someone help me with his answer and why
Do you prefer data binding - which is ready with c#- or doing it yourself -I mean to write the complete code yourself?
Really I tried the two but I found data binding is fast but may come with error that hardly you find it, on the other hand Writting the code by myself is safe and easy to find any errors but very long time I take!!!!!!!!!
Regards,
Hisham Galal <me4webby@yahoo.com>
|
|
|
|
|
I prefer writing the hook up code myself, however, you can save time and bugs by having databinding do it for you.
|
|
|
|
|
i make databinding and change query strings and other parameters in code where required it saves time and iss more reliable but this meathod dosent work so well with crystal reports ( in case when you have schema changes in dataset )
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
how to select a perticular cell on DataGridView.Are there any method? without
" cell.selected=true " are there any? same....tell me how to move on cell by
arrow skipping unwanted columns...every code sample with DataGridView Control
plz post to me......i welcome all.
additional***
i want to select a cell (set focus to the cell) it means when cell got F2 mode.i'm developing VS.net 2005 IDE.here in a cell select and press F2 it comes to edit mode.i want set focus to a cell programitically.send sorce code.
like "TextBox.Focus()" the same thing should happen here also..
-- modified at 9:08 Monday 16th October, 2006
|
|
|
|
|
To select a particuler row follow the following code.
DataGrid.CurrentRowIndex = 4;
DataGrid.Select();
i am not clear with the secod part of your question.
what i got is how to select row on pressing arrow key.
if it is the question then trap the key arrow keys in keyDown event of data grid i.e. datagrid_keyDown(sendr,evenrargs){}
trap arrow keys and select the currentrow index
sameer
|
|
|
|
|
thanks lot for answering to my question...but it's not answer what i expect.
i want to select a cell (set focus to the cell) it means when cell got F2 mode.i'm developing VS.net 2005 IDE.here in a cell select and press F2 it comes to edit mode.i want set focus to a cell programitically.send sorce code.
like "TextBox.Focus()" the same thing should happen here also..
|
|
|
|
|
hope you are able to put grid edit mode.it'll solve your problem
DataGridCell cell = this.myDataGrid1.CurrentCell;
cell.RowNumber=5;
cell.ColumnNumber=2;
this.myDataGrid1.CurrentCell = cell;
sameer
|
|
|
|
|
Hi all,
I want to retrieve settings (connection string etc) from app.config and that shouldn't be a big problem, I thought.
My app.config looks a little like this:
<configuration><br />
<configSections><br />
</configSections><br />
<connectionStrings><br />
<add name="vrsConnectionString" <br />
connectionString="Data Source=LT01;Initial Catalog=vrs;Integrated Security=True"<br />
providerName="System.Data.SqlClient" /><br />
</connectionStrings><br />
</configuration>
Searching at the web says I can use something like:
System.Configuration.ConfigurationManager.AppSettings[key]
where key should be replaced with "vrsConnectionString", I presume.
But I can't find that.
I have the:
System.Configuration.ConfigurationSettings.AppSettings[key] (which is obsolete)
And using that returns a null value, I.e. haven't found the key.
I have added: using System.Configuration to my code.
I'm using .Net 2.0.50727
MS Visual Studio 2005 ver: 8.050727.42
Anyone who can explain what I'm doing wrong here?
Mike
|
|
|
|
|
System.Configuration.ConfigurationManager.ConnectionStrings["vrsConnectionString"].ConnectionString;
|
|
|
|
|
I have a windows app that produces an XML document from various input data. I need to read this XML from the application integrated web browser so as i can use in the application to populate fields. The browser is running a coldfusion page and the XML must be returned to the windows application that will be run on a separate server ( the windows app is in C# ).
|
|
|
|
|
What do you get back when you look at Browser.Document? Or the inner HTML of that document?
|
|
|
|
|
I have an XML document on a cfm page and need to access the XMLdocument struct to sample the data in it. There will only ever be 1 record at a time in the XML. I don't have much C# experience and am having trouble with the transfer of the data from windows application through the web interface and back to the native windows application again. I can supply code if it would be of any assistance. Thanks Fro looking.
|
|
|
|
|
Hello,
I have a more ore or less complicated business object, that looks
similar to this:
<entry>
has some properties (id, pubdate...)
and a list of <version>s
each <version> has a language, a title and a description
Entry also has a list of s
each , has a List of <imageinfo>s with language, title and description
To edit the objects properties I created a similar structure of controls
<entrycontrol> has some Textboxes, a Tabstrip, holdig Tabs
corresponding to <version>s, again holding some Textboxes, and a list of
<imagescontrol>s with their <imageinfocontrol>s.
The question is, should the control A) know of the business object it
represents?
Should I instantiate EntryControl like this?
Entry e = Entry.GetEntry("abc");
EntryControl ec = new EntryControl(e);
and "inside" of EntryControl my Properties would be
public string Id {<br />
get { return entry.Id; }<br />
set {<br />
entry Id = value;<br />
TextBoxId.Text = value;<br />
}<br />
}<br />
<br />
and have problems, once the user edits the fields, a call to Id, would
still yield the object's value and not the textbox' new text value.
But I'd have the advantage (still in Entry) that I could much better
encapsulate the child controls creation and logic.
public EntryControl(Entry entry) {<br />
VersionControl versionControl = new VersionControl();<br />
versionControl.Versions = entry.Versions
}
or B) should my Controls be completely agnostic containers of agnostic
sub controls (as the generic .net controls are)
Instead:
class EntryControl {<br />
private Textbox textBoxId, textBoxPubDate;<br />
<br />
public string Id {<br />
get {return textBoxId.Text; }<br />
set {textBoxId.Text = value; }<br />
}<br />
<br />
public VersionControl VersionControl;<br />
}<br />
<br />
class Client {<br />
void DoSomething() {<br />
Entry e = Entry.GetEntry("abc");<br />
EntryControl ec = new EntryControl();<br />
ec.Id = e.Id;<br />
ec.VersionControl = new VersionControl();<br />
foreach(Version v in e.Versions) {<br />
VersionTab tab = new VersionTab();
tab.Title = v.Title;<br />
ec.VersionControl.Tabs.Add(tab);<br />
}<br />
}<br />
}
What is your opinion? What is the best pattern in relation business
objects vs controls.
To me it seems version A encapsulates better, is easier to read and is
more comfortable to use. But concurrency makes it less attractive;
B has the advantage of dumb controls that cannot do anything wrong,
but writing the client code is an ugly hack. Still there would be no mingling of business and representation layer, which I think is of advantage.
Any beautiful patterns, recomendations, ...?
Thanks!
--
Jan
www.limpens.com
|
|
|
|
|
A - the business object layer shouldn't know anything of how the data will be presented.
|
|
|
|
|
Neither in A or B the businesslayer has any knowledge of it's representation (in my examples)
|
|
|
|
|
Hi,
How can i check 50 answers which are all typed in a textbox when a button is pressed?
This is what i had:
private int[] answer = new int[51];
for (int i = 1; i < 51; i++)
{
if (this.answer[i] == int.Parse(((TextBox)Controls["TextBox"+i.ToString()]).Text))
{
//label.ForeColor = Color.Green;
MessageBox.Show("testtttt");
}
}
Anyone got a better suggestion? Because this is somehow not efficient.
Thanks in advance!
|
|
|
|
|
Yustme wrote: new int[51];
If you only have 50 things, why are you creating an array of 51 items?
Yustme wrote: for (int i = 1; i < 51; i++)
Why do you start the iteration on the second item. Why don't you use the first item in the array?
Yustme wrote: (((TextBox)Controls["TextBox"+i.ToString()]).
Why not have an array of TextBoxes (TextBox[] ) preset up. Then when you iterate through them you don't have to do this?
|
|
|
|
|
Hi Colin,
I changed it back as it was before:
for (int = 0... 50, i++)
What do you mean by preset the textbox's up?
I tried that, but it doens't recognize the 'Text' property.
|
|
|
|
|
You have a loop that gets the text boxes that you need then processes them. The way it is finding the text boxes is inefficient. Do this step only once on the form load by populating a TextBox array. When you need to loop over all the text boxes, you are looping over a pre-built textbox array which is much more efficient than lookin up each textbox by name.
|
|
|
|
|
Hi Colin,
I changed that now.
|
|
|
|
|
Yustme wrote: TextBox[] textBox = new TextBox[50];
That initialises a new EMPTY array of text boxes
Yustme wrote: textBox.Text
You are attempting to get the text property from the ARRAY. You need to iterate over the array
e.g.
for(int i=0; i<50; i++)
{
TextBox currentTextBox = textBox[i];
if (this.answer[i] == int.Parse(currentTextBox.Text))
{
}
}
|
|
|
|
|
Hi Colin,
That worked good, thanks!
Somehow my answer[i] is reversed. It contains the answer of the first label in the last index, instead of in the first index.
How can i change the way the array is filled?
-- modified at 9:01 Monday 16th October, 2006
|
|
|
|
|
Yustme wrote: How can i change the way the array is filled?
How are you filling it now?
|
|
|
|
|
Hi Colin,
I think i found the problem.
It was the way that C# generates the code where it put label1 at the bottom and label2 above it and so on.
I changed that. So it works fine now.
|
|
|
|
|
hi
i set button1.image to an icon, but image was bigger than button and i want to fit in my button and set align to left, how to do ?(i was set other button.Image to icons and image fit to buttons but in this one image don't fit in my button)
thanks ...
|
|
|
|