|
I have placed a datagrid in winforms and i added a bindingsource to the grid
after that i go to edit columns and changed the cell into datagrid combobox
one datagrid rows contains 10 columns
my question is depend upon the selection in the combo box the remaining all columns values should be displayed
any one can help me please
|
|
|
|
|
hi
i have to generate a report for my project and it is in the following format
Loads on Structure // Heading
Dead Load //Sub Heading1
Dead Load1 -- 200 KN/m
Dead Load2 -- 250 KN/m
Live Load // sub heading2
Live Load1 -- 150 KN/m
Live Load2 -- 100 KN/m
etc like
Now to display the report in this format
which report should i choose
and which one is best and has more advantages
i dont know about these reports
but by R&D i came to know that Report.rdlc cannot export to Ms-word application
now what to do ...
Please give me a good advise
Thanks in advance
lavan
|
|
|
|
|
I will try to run the nlp project. I don't know how to conver the ".nbin" file to ".bin".
|
|
|
|
|
F2 lets you rename a file. If you need to convert between formats, then you need to read up on the formats and write a converter.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi everyone,
I know this's a lame question but what is the shortest way to modify a control in a separate thread without raising the cross-thread exception..
I basically have this datagrid control and when changing its databinding properties, it's binding fine except it doesn't show it correctly.
Please help guys!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
you can turn off the cross thread exception if you want to. That's the quickest way to do it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Yeah... How about slowing down a bit
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Christian Graus wrote: you can turn off the cross thread exception if you want to. That's the quickest way to do it
it also is the quickest way to a disaster. I never understood why MS introduced this property,
I see no use for it whatsoever. The use of InvokeRequired/Invoke, either explicit or hidden as in BackgroundWorker events, is mandatory.
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 Friday, June 10, 2011 11:29 PM
|
|
|
|
|
Usually, I'm using BeginInvoke with an anonymous method:
string newValue = ...;
BeginInvoke(new Action(delegate {
theControl.Property = newValue;
}));
You have to be a bit careful with BeginInvoke as it's always an asynchronous call; when called from the GUI thread it will delay executing the delegate until your code returns to the message loop. And you have to be careful what variables you use in the delegate - e.g. if you use a loop variable, it might have changed to the value for the next iteration before BeginInvoke calls your delegate.
But BeginInvoke is faster than Invoke because it doesn't have to wait, and it doesn't have the potential for deadlocks.
|
|
|
|
|
Hey, thanks Daniel!! That was short and very helpful!
Thanks again mate!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
I thought it would be possible to add a static event handler and attach to it from outside the form code add the event listener then instantiate the form with Application.Run(new Form()).
Inside the Form, the Event gets fired, and then calls Form.Close(), Application.Exit() on the Sender object (the Form) but I get an error that I cannot access an Disposed object.
I thought this would be possible if the EventHandler was static I thought it would not care if the object was disposed.
Thanks for any help guys sorry I am a newbie to UI programming.
|
|
|
|
|
Not sure I got your question. Please post relevant code so that we understand what you are saying.
|
|
|
|
|
Thanks Navaneeth,
Here is an example of what I am trying to do:
// Entry Point:
DummyForm.TestsFinished += new EventHandler(DummyForm_TestsFinished);
// Start Processing the query
// viewFrameworkDummyForm.ProcessQueryInstructions(queryInstructions);
// Start the Application message pump (the viewFx has to be run on a form to be contained within a thread UI)
DummyForm myForm;
// ****************************************
// I get a Cannot access disposed object ex on this below line:
// ****************************************
Application.Run(myForm = new DummyForm(queryInstructions));
// DummyForm:
public partial class ViewFrameworkDummyForm : Form
{
private List&lt;QueryInstruction&gt; queryInstructions;
public static event EventHandler TestsFinished;
/// <summary>
/// Constructor
/// <summary>
void DummyForm(List<QueryInstructions>queryInstructions)
{
…
// Does stuff with query instructions…
…
// Event gets fired somewhere in the constructor…
OnQueryInstructionsProcessed(this,new EventArgs());
…
}
// Notifies the attached events to QueryInstructionsProcessed, that the query instructions have been processed.
void OnQueryInstructionsProcessed(object sender, EventArgs e)
{
//Inform that the tests have been finished, and then close the form..
TestsFinished(this, new EventArgs());
this.Close();
Application.Exit();
}
}
|
|
|
|
|
i wanna pull multiple records in from a database and display them in different labels
I was thinking of returning them in an array then adding them to the specified labels, can anyone point me to the an example or aid me.
sample code
public partial class _Default : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("server=BABOO;uid=sa;password=sa;database=quiz");
protected void Page_Load(object sender, EventArgs e)
{
con.Open();
string query;
query = "select QuestionText,AnswerA,AnswerB,AnswerC,AnswerD from quest where QuestionID='1'";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataReader dr;
dr = cmd.ExecuteReader();
while (dr.Read())
{
nt rbCount = Convert.ToInt32(TextBox2.Text);
RadioButton[] radioButtons = new RadioButton[rbCount];
for (int i = 0; i < rbCount; ++i)
{
radioButtons[i] = new RadioButton();
radioButtons[i].Text = dr.GetValue(1).ToString();
}
Please i need your help
Ferron
|
|
|
|
|
So, this seems a little retarded to me.
1 - you want to have a textbox showing how many answers to show ? So, what if the right answer gets hidden ?
2 - how do you make sure that textbox2 contains a number ?
3 - why don't your variables have real names ?
4 - You're reading the same value from the answer list every time
5 - you never add the radio buttons to your UI
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
i know, that's why i need your help to sort it out the write way. basically what i have is 3 textbox
text[1]
text[2]
text[3]
if three records are in the database it should bring back three sets of record all in their respective textbox.
Plz can u help
Ferron
|
|
|
|
|
So the possible answers go in textboxes, not in radio buttons ?
Are you saying the number of answers is flexible ? I would do this with a data bound control, assuming I had to show more than one question on a page.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Yes I want to show the results in the text box? I have it created in a form. Is the the data bound control flexible? Can the realit be formatted in a form like manner, for say a application form?
Ferron
|
|
|
|
|
Yeah, you can define a template for a data bound control and show the data any way you like.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have used a form view, its working well, the thing is how do I get it to display records one under the other instead of paging?
Ferron
|
|
|
|
|
I used a data list control to display all my records, but i have been trying to add paging capability.
Ferron
|
|
|
|
|
I am trying to write some code that will read the contents of a file (C:\Temp\index.html) and replace any smart quotes (“ and ”) with neutral quotes ("). I can find the quotes if I open the file with 1252 encoding, but the replacement does not work. Also, the quotes are found even though they are showing found as values of hex 201C and 201D even though the smart quotes are hex 93 and 94 if I open the file in a hex editor .
using System;
using System.Text;
using System.IO;
namespace EncodingExample
{
class Program
{
static int CharPositions(string data, char[] chars)
{
int count = 0;
int pos = data.IndexOfAny(chars);
while (pos > -1)
{
count++;
Console.WriteLine(" Position: {0}", String.Format("{0:X}", pos));
pos = data.IndexOfAny(chars, pos + 1);
}
return (count);
}
static void Main()
{
string srcFile = @"C:\Temp\bosssystems\index.html";
if (File.Exists(srcFile))
{
char[] chars = { '"', '"' };
char quote = '"';
string data = File.ReadAllText(srcFile, Encoding.GetEncoding(1252));
Console.WriteLine("Before Replacement");
CharPositions(data, chars);
Console.WriteLine();
foreach (char c in chars)
{
data.Replace(c, quote);
Console.WriteLine("Replacing {0}({1}) for {2}({3})", c, String.Format("{0:X}", (int)c), quote, String.Format("{0:X}", (int)quote));
}
Console.WriteLine();
Console.WriteLine("After Replacement");
CharPositions(data, chars);
Console.ReadKey();
}
}
}
}
|
|
|
|
|
When you load the file, the byte codes 0x93 and 0x94 are decoded into the unicode characters with character codes 0x201C and 0x201D.
Does the compiler support unicode in the source code? I would write the characters using escape codes so that I was sure that I got the correct characters:
char[] chars = { '\u201C', '\u201D' };
The replace is probably working just fine, but you are throwing away the result. The Replace method returns the result, and you have to assign it to something, like assigning it to the string variable where you had the input:
data = data.Replace(c, quote);
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hello again,
I'm wondering, is there a way to have an event set up so that if a registry key is created, accessed or modified in much the same way a FileWatcher works?
Thanks,
Michael Fritzius
|
|
|
|
|
I don't believe so.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|