|
I have used a RichTextBox in the past, and simply required that the end user has the microsoft language pack installed. That way, the OS deals with the language exclusively (changing keyboard input and the like), which makes this kind of operation transparent to your application.
-Jeff
|
|
|
|
|
Hello everybody, I encounter a problem and need your help.
In a MDI application of C#, I want to show a PDF file in a child form. I have added a PDF browser to the child form and change it to pulic, just like below:
public AxAcroPDFLib.AxAcroPDF pdfBrowser;
When the MDI load, my code likes below:
Code:
private void MDIFrm_Load(object sender, EventArgs e)<br />
{<br />
ChildFrm myChildFrm = new ChildFrm();<br />
myChildFrm.pdfBrowser.LoadFile("C:\\dev\\linux-i18n-intro.pdf");<br />
myChildFrm.MdiParent = this;<br />
myChildFrm.Show();<br />
}
However,I can not see the PDF content in the Child form,but if I set the ChildFrm as the strartup object,it will show PDF correctly.
Could anyone give some suggestions?
Thanks very much!
Birch
|
|
|
|
|
I can only guess:
maybe the pdfBrowser loads an empty file on Form_Load?
Anyway: you should not put the pdfBrowser on a public property - better give the path to the constructor and set it in the form.
Anyway he problem seems to be with the pdfBrowser - maybe try using the webbrowser-control to show your files?
|
|
|
|
|
hi,
My aim is to print the datagridview text in to a textbox on clicking it .. i have done this before unfortunately i am not able to recollect it so if any one knows this please do inform me
REGARDS
SINDHU TIWARI
its me sid
|
|
|
|
|
just write the concerned code in cell click event
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
I have encountered similarly problem ,please give me some code for this question
my english is very bad!
|
|
|
|
|
Here is the code snippet:
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
textBox1.Text = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
}
Gopal.S
|
|
|
|
|
I have written many methods that using DataSet.
Now, I realise that I need the property 'CaseSensitive' of every DataSet instance to be 'true'. I don't want to change every source file to make it. Is there any simple way to make each DataSet instance created with 'CaseSensive = true'? e.g. envirment setting
I am using Visual Studio 2005 (.NET 2.0).
Thank you.
|
|
|
|
|
Hi all,
I recently found out about microthreads and I'm looking for more info on this topic (for implementation in C#) !
Any one knowing links to existing classes or articles ? Please let me know !
Thanks in advance !
Greetz,
Geert
|
|
|
|
|
Hi all,
I'm sending some data over TCP/IP and when I make use of a special character like ~ (tilde) it displays on my TCP/IP server as +AH4-
This is the code:
client.Client.Send(System.Text.Encoding.UTF7.GetBytes(richTextBoxSendData.Text));
Many Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
well seems your TCP/IP server don't understand UTF7 - try ASCII!
(System.Text.Encoding.ASCII.GetBytes(...)
|
|
|
|
|
Thanks for the response, I'll give it a shot
Regards
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hello All,
I have a situation here, where in, i have to pass a ref object to a method that has to be called within a thread. how to pass that ref object within the parameterized thread.
Public void methodname(ref string Strname)
{
..
..
..
}
parameterizedthreadstart prmThst = new ParameterizedthreadStart(mehthodname(ref StrName)
thread thnew = new thread(prmthSt);
this is throwing error..
Help is required..
Thanks and Regards
Bharath.S Ron
|
|
|
|
|
no you hate to put it that way:
<br />
ParameterizedThreadStart prmThst = new ParameterizedThreadStart(methodname);<br />
Thread thNew = new Thread(prmThst);<br />
<br />
thNew.Start(ref StrName);<br />
|
|
|
|
|
When attaching a datasource to a combobox, one can choose to specify its display and value member. For instance...
class PhoneContact
{
... // omitted
public string Name { get { return this.name; } set { this.name = value; }
public string Number { get { return this.number; } set { this.number = value; }
}
PhoneContact[] arr;
combobox1.DataSource = arr;
combobox1.DisplayMember = "Name";
combobox1.ValueMember = "Number";
I wanted the drop down list to show a combination of Name and Number concatenated together but the show just the number in the textbox field of the combobox. How do I do that?
drop down list will show like this,
Name1, Number1
Name2, Number2
..., ...
And after you select one of them, it only shows number in the textbox field and not the concatenated one.
Rationale:
You have a list of numbers in your phone book, I decided to allow the user to choose one of the numbers from the phonebook in a lookup manner via the combobox. Or if the number does not exist, one can key in any number not from the phonebook into the combobox textbox field. However, the combobox will only show the value from a single field specified by DisplayMember, if I had made "Number" as the display member, a drop-down list of numbers will be meaningless to the end user when he can't even tell who the number belongs to. And if I put the DisplayMember as "Name", somehow, the end user would not be able to verify if the number associated to the name is correct or wrong.
And ideas? Thanks
|
|
|
|
|
This is very easy in your example: just add a property - let's say
<br />
public string DisplayValue<br />
{ get { return Name + ", " + Number; } }<br />
to your PhoneContact class and use
<br />
combobox1.DisplayMember="DisplayValue";<br />
that's it.
|
|
|
|
|
Yes I've tried that myself,
the only catch is that after you have selected one of values in that concatenated form from the drop down list, the textbox field is populated with "Name, Number", where what I would liked was just the number itself in the textbox field.
Eventually, what I need is just the number value where for some reason can't just get from SelectedValue property.
In a case where no number exists in the drop down list, SelectedValue property will be null or empty if some other number was entered into the textbox field of the combobox.
string number = string.Empty;
If (combobox1.SelectedValue == null)
number = combobox1.Text;
else
number = combobox1.SelectedValue.ToString();
And that's exactly why after the selection from the drop down list, I only want a number and not the concatenated string of "Name, Number" to be in the number variable.
|
|
|
|
|
then use
<br />
number = combobox1.Text.Substring(0,combobox1.Text.IndexOf(','));<br />
in the case where SelectedValue == null !
|
|
|
|
|
Hmmm... never thought of that... I appreciate this... thanks a million.
|
|
|
|
|
I have to export the data present in the datagridview to Microsoft Excel. It is a window application using c#. Does anyone know how to do it. Please help.
Thanks
|
|
|
|
|
|
I have a method in a common base class thus :
protected bool SetFlag(bool _new, ref int _flags, int _flag, string _pName)
{
bool __cancelled = false;
bool __old = ((_flags & _flag) == _flag);
if (!__old.Equals(_new)
{
if (!(__cancelled = this.RaisePropertyChanging(__old, _new, pName)))
{
_flags = (_new) ? _flags | _flag : _flags & ~flag;
this.RaisePropertyChanged(__old, _new, pName);
}
}
return __cancelled;
}
In derivatives of the common base I want to use SetFlags as is shown in the example at the end of this post, but I get a message telling me that it can't cast a ref to an AmbientState to an int etc.
If I give SetFlag a Type argument then I can only constrain it to a class(reference type) or struct(value type), but in that case I get compile errors stating that bitwise operations cannot be performed on T objects, ie structs.
The content of _flags (ambientState in the example) must be changed BEFORE PropertyChanged handlers are invoked.
I have a work-around - The _flags parameter is not passed by reference and I've added a delegate method argument to SetFlag that gets invoked between the "flags = ...." and the "this.RaisePropertyChanged...." statements, the delegate looks like
private void saveFlags(int _flags) { this.ambientState = (AmbientState) _flags; )
But like all workarounds its ugly and necessitates documenting why the delegate exists etc.
Rgds PhilD -- Sample usage of SetFlags follows
public class MyClass : CommonBase
{
AmbientState ambientState = AmbientState.ZeroValue;
public bool Morning
{
get { return ((this.ambientState & AmbientState.Morning) == AmbientState.Morning); }
set { this.SetFlag(value, (int) ref this.ambientState, AmbientState.Morning, "Morning"; }
}
[Flags]
private enum AmbientState : int
{
ZeroValue = 0x0
Morning = 0x1
Afternoon = 0x2
Evening = 0x4
Night = 0x8
ClearSky = 0x10
CirrusSky = 0x02
etc
}
}
|
|
|
|
|
The most obvious solution is to set an int value, call the method with a ref to that value, then reset it to the ambientState property, as follows:
public bool Morning {
get { ... }
set {
int as = (int)this.ambientState;
this.SetFlag(value, ref as, ...);
this.ambientState = (AmbientState)as;
}
} Another solution I see is doing the reverse, which is probably better, since you cut down on the responsibility of the user, and to impede type checking for your enum type. Do this as follows:
protected bool SetFlag(bool _new, ref AmbientState _flags, AmbientState _flag, string _pName)
{
int flag = (int)_flag;
int flags = (int)_flags;
bool __cancelled = false;
bool __old = ((flags & flag) == flag);
if (!__old.Equals(_new)
{
if (!(__cancelled = this.RaisePropertyChanging(__old, _new, pName)))
{
flags = (_new) ? flags | flag : flags & ~flag;
this.RaisePropertyChanged(__old, _new, pName);
_flags = (AmbientState)flags;
}
}
return __cancelled;
} And finally, the RECOMMENDED way of doing this, is setting the FlagsAttribute on the enumeration as follows:
[FlagsAttribute]
public enum AmbientState {
...
} This final way allows you to use &, |, and ^ on the values of the enumeration. I'm not sure if you can use ~, but you can always go to find out! Hope this helps,
-Jeff
|
|
|
|
|
|
Hi you have some options.
1) use the fields in your datagrid. Attention, this method might be slow.
Just itterate throug your rows:
<br />
<br />
<br />
foreach (DataGridViewRow row in settingDataGridView.Rows)<br />
<br />
{ <br />
runningtotal += decimal.Parse(row.Cells[columnIndex].ToString();<br />
}<br />
2) get the data from the data behind the DataGridView
<br />
documentlinebindingsource.EndEdit();<br />
<br />
foreach (DataRow row in ds.DocumentLine.Select("documentId=" + documentId))<br />
<br />
{<br />
<br />
if (row.RowState != DataRowState.Deleted)<br />
<br />
{<br />
ds.DocumentLineRow docLineRow = (ds.DocumentLineRow)row;<br />
<br />
...<br />
runningtotal += row.documentLineTotal;<br />
<br />
}<br />
<br />
}<br />
<br />
Hope this will help you.
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|