|
Bobbydoo9 wrote: but I'm having very little luck
Luck has nothing to do with it.
Bobbydoo9 wrote: I can never find the right code snippets
You should consider "writing" your own code rather than using "copy-paste" to develop software.
Bobbydoo9 wrote: What i'm trying to do is take "A"
and add 3 (+3)
and come up with "D" "D"
It's a secret so don't tell on my for this but.... information about how to do that has been skillfully hidden in the C# documentation by Microsoft.
have fun with your homework assignment.
led mike
|
|
|
|
|
led mike wrote: You should consider "writing" your own code rather than using "copy-paste" to develop software.
It would be awesome if someone wrote an usable program ENTIRELY out of little snippets found on teh Interwebs, with references and everything...
Windows Calculator told me I will die at 28.
|
|
|
|
|
I hope this helps
int a = Convert.ToInt16('A');
a = a+3;
Console.WriteLine(Convert.ToChar(a));
|
|
|
|
|
Hi,
Is there a way to programatically scroll to the bottom of a listview (it's in detail mode)?
thanx
|
|
|
|
|
|
Thanx!
I was looking for something like "ScrollTo" and didn't find it..
|
|
|
|
|
I have a datagrid that is using table styles. I want to allow users to select which columns are visible through a basic column selction form.
The problem I am having is that whatever cell is currently selected when I launch my columnselction form stays selected and will never lose focus! I can select other cells afterwards but the original cell always stays selected. If I launch the columnselection form additional times, whatever cell has focus then also stays focused. Hence, I can have 25 cells with permanent focus if I launched my columnselection form 25 times.
My code is as follows:
//Mainform code to get current visible columns and to launch columnselection form
ArrayList columns = new ArrayList();
for(int i=0; i<this.cdatagrid.tablestyles[0].gridcolumnstyles.count; i++)
{
string="" temp="this.cDataGrid.TableStyles[0].GridColumnStyles[i].MappingName;
columns.Add(temp);
}
vc" =="" new="" viewablecolumnsfordg(this,="" columns);
this.enabled="false;
vc.Show();
//Code" in="" vc="" after="" selecting="" columns
private="" void="" selectbutton_click(object="" sender,="" system.eventargs="" e)
{
="" mainform.cdatagrid.suspendlayout();
="" this.columns.clear();
="" for(int="" i="0;" <="" cboxlist.count;="" i++)
="" {
="" checkbox="" cb="(CheckBox)cBoxList[i];
" if(cb.checked)
="" columns.add(cb.text);
="" }
="" mainform.viewablecolumns="this.columns;
" mainform.cdatagrid.tablestyles.clear();
="" mainform.setctablestlye();
="" mainform.enabled="true;
" mainform.bringtofront();
="" mainform.cdatagrid.refresh();
="" mainform.cdatagrid.update();
="" mainform.cdatagrid.resumelayout();
="" this.close();
}
="" mainform="" code="" for="" setctablestlye();
public="" setctablestlye()
{
="" datagridtablestyle="" tblstyle="new" datagridtablestyle();
="" tblstyle.mappingname="mainData" ;
="" viewablecolumns.count;="" j="0;" standardcolnames.count;="" j++)
="" datagridtextboxcolumn="" dgcol="createDataGridColumn((string)viewableColumns[i]);
" tblstyle.gridcolumnstyles.add(dgcol);
="" tblstyle.rowheadersvisible="false;
" }
="" cdatagrid.tablestyles.add(tblstyle);
}
="" createdatagridcolumn
private="" createdatagridcolumn(string="" mappingname)
{
="" datagridtextboxcolumn();
="" dgcol.mappingname="mappingName;
" dgcol.headertext="mappingName;"
="" dgcol.width="115;
" dgcol.nulltext="String.Empty;
" dgcol.textbox.click="" +="new" system.eventhandler(openc_clicked);
="" dgcol.textbox.keydown="" system.windows.forms.keyeventhandler(openc_enterkey);
="" dgcol.readonly="true;
" return="" dgcol;
}
i'm="" sure="" this="" is="" really="" simple="" but="" can't="" find="" a="" way="" to="" unfocus="" the="" column=""
thanks!=""
<div="" class="ForumSig">RABB17
"Nothing fancy needed, please just solve all our problems as quickly as possible."
|
|
|
|
|
I'm using global keyboard and mouse hooks in an app. Under XP it runs fine, under 2k or NT4 it does as well, except for one really wierd behavior. If I do a crtl-alt-del while the hooks are set, and close the screen with the escape key instead of the mouse once I exit my app double clicking in explorer or on the desktop no longer work, not does selecting an icon and hitting enter. This doesn't happen in XP, it doesn't happen in 2k if I close the screen using the mouse.
Since this doesn't happen under XP I strongly suspect it's a windows issue that was fixed but not backpatched to older versions. That said, has anyone seen this before, or have any idea how to fix/work around the issue?
|
|
|
|
|
Hello,
I have an PowerPoint2003 Add-In developed in C#.
It is possible to port it on Mac? (MS PowerPoint 2004 for Mac)
If no - what kind of alternatives would you recommend?
Thanks
|
|
|
|
|
I'm not sure if Mono supports MAC, but I would check there first.
|
|
|
|
|
I have a screen that is populated by moving up and down a list view.
If I move through the list quickly (indexchange event) the population of the form goes crazy and I lose focus on the list box. I suspect that it is validation that is causing the problem as the form is populated and focus moves from the various controls.
How can I suspend these events untill after the form is populated?
|
|
|
|
|
why this code doesn`t work? (VS 2003)
declaration, and, possibly, assigment:
DateTime dataTermino = null;<br />
if(txtDataInicio.Text != "")<br />
dataTermino = DateTime.Parse(txtDataTermino.Text);
and, in another class, the test:
if(dataTermino != null)<br />
insertCommand.Parameters.Add(new SqlParameter("@DataTermino", dataTermino));
VS2003 Errors:
* Operator '!=' cannot be applied to operands of type 'System.DateTime' and 'null'
* Cannot convert null to 'System.DateTime' because it is a value type
WTF!
thanks...
|
|
|
|
|
before using the datetime variable you must create it.
DateTime dataTermino = new DateTime()
will do the job for you
|
|
|
|
|
ok, but after i want test if it is null.
with a object reference i cant test it, and i dont want reference the actual date.
|
|
|
|
|
There are 2 types of objects in .NET: reference types and value types. All classes are reference types. All structs are value types. All reference types can be assigned null. All value types cannot.
The reason for these 2 is for lightweight, fast stack-allocated values. For instance, System.Int32 , also aliased as int is a value type: you can pass it to a function which will actually pass a copy of the value.
Value types always must have a value; you can't assign them null, as that's not how value types work, nor should it be. Assigning an integer to null doesn't make sense, for instance. And since DateTime is a value type, you can't assign null to it.
Now, if you were using .NET 2.0, there is a new wrapper class called System.Nullable, where you can wrap a value type inside an object that can either be null or the value. Here's what that looks like:
Nullable<DateTime> nullableDateTime = new Nullable<DateTime>;
nullableDateTime = null;
nullableDateTime = DateTime.Now;
C# 2.0 has short-hand syntax for this, using the question mark:
DateTime? nullableDateTime = new DateTime?();
nullableDateTime = null;
nullableDateTime = DateTime.Now;
|
|
|
|
|
hey... thanks...
i`ve used a overloaded method to deal with this situation, instead of testing if a parameter is null or not.
great explanation... it was very instructive. :]
cya
|
|
|
|
|
tcss wrote: before using the datetime variable you must create it.
Not at all. DateTime is a value type, not a reference type.
---
b { font-weight: normal; }
|
|
|
|
|
Cut my teeth in C# with .Net 2.0. See comment below.
Thanks for correcting my post
|
|
|
|
|
The DateTime class is a struct and so can't be null. It's just like int, double, or one of the other value types, they can't be null.
|
|
|
|
|
pontonet wrote: WTF!
Why not learn more about the environment in which you are developing before exclaiming "WTF!". The difference between value and reference types is in any good beginners guide to .NET and/or C#.
|
|
|
|
|
sometimes we forgot the basic, even after read a lot of stuffs.
sometimes we are kinda influencied by other languages, like java.
a DateTime tends to be a real object instead of a value type - it has properties, methods, constructors, etc. so the difference isn`t so obvious.
|
|
|
|
|
If you're using C# 2.0 you can declare DateTime as nullable with the following:
DateTime? dataTermino = null;
if(txtDataInicio.Text != "")
dataTermino = DateTime.Parse(txtDataTermino.Text);
if(dataTermino != null)
insertCommand.Parameters.Add(new SqlParameter("@DataTermino", dataTermino));
(note the "?" after DateTime)would work. If you're not using 2.0 & need to pass null date to SQL , have a look at:
http://www.c-sharpcorner.com/Code/2003/Sept/EnterNullValuesForDateTime.asp[^]
Hope this helps
|
|
|
|
|
Does anyone know of an easy way to maintain a series of assembly 'reference paths' across a large number of projects.
I understand they are persisted in the proejct 'user' settings files. Initially i was wondering whether you could do something similar to a #Include in a xml. So at least they would only be stored once.
Cheers
Aj
|
|
|
|
|
what you want isn`t the same result achieved with a added DLL reference mapped directly to the user file system?
|
|
|
|
|
Hello,
How can I get all contents in RichTextBox and convert it to HTML format
My RichTextBox on winform. And I want to get it contents in HTML to sent it to my mail. But it doesn't work properly when I set BodyFormat = HTML.
Thank you,
ACB
-- modified at 12:25 Thursday 26th October, 2006
ngh
|
|
|
|