|
There are three problems i am facing
1. If i specify (1,1) then i should get A1, how can i achieve that.
2. How can i get reference of a particular cell,without using Range class , i want to get cell's forecolor and backcolor directly.
|
|
|
|
|
i have created a winform.but i can't connect it with my database.there are no error has shown but there have 3 warning about path.but i can't find the right path.How can I solve this problem?
|
|
|
|
|
Well, hard to say without knowing what sort of DB it is, and what your warnings are, and what your connection string is.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Can you Explain Brielfy what you have done and let us see your code that connects to the Database
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
private static string ToDbfFieldTypeString(Type pType)
{
string sResult = "";
try
{
if (pType == typeof(int))
{
sResult = "int";
return sResult;
}
if (pType == typeof(long))
{
sResult = "long";
return sResult;
}
if (pType == typeof(float))
{
sResult = "float";
return sResult;
}
if (pType == typeof(double))
{
sResult = "double";
return sResult;
}
if (pType == typeof(decimal))
{
sResult = "number";
return sResult;
}
if (pType == typeof(bool))
{
sResult = "char(2)";
return sResult;
}
if (pType == typeof(DateTime))
{
sResult = "date";
return sResult;
}
if (pType == typeof(string))
{
sResult = "string";
return sResult;
}
}
catch //(Exception excp)
{
sResult = "";
}
return sResult;
}
-------------------------------------------------------------------
i change the if-else structure to switch structure as follow:
but it tell me to input an integer value at switch();
switch (pType)
{
case typeof(int):
return "int";
case typeof(long):
return "long";
case typeof(float):
return "float";
case typeof(double):
return "double";
case typeof(decimal):
return "number";
case typeof(bool):
return "char(2)";
case typeof(DateTime):
return "date";
case typeof(string):
return "string";
}
So,buddy,could you help me modify the code to compile success?
And tell me what type of value does the switch(?) allow to use? Thanks!
|
|
|
|
|
panyl wrote: but it tell me to input an integer value at switch();
No, it tells you you need an integral type. I googled your error message and found this:
The C# compiler informs us that a switch statement can only take certain integral types. To be more specific, it can take an sbyte, byte, short, ushort, int, uint, long, ulong, char, string, or an enum-type. C# realizes that the switch has received a yyy object and since it cannot convert a yyy into the above integral types, it reports an error.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
A switch statement can take an enum because:
"Every enumeration type has an underlying type, which can be any integral type except char." source MSDN[^]
In your situation this helps because you can use the GetTypeCode() method which returns an enum member.
deciaml d = 0;
switch (d.GetTypeCode())
{
case TypeCode.Decimal:
Console.WriteLine("It's a deciaml");
break;
case TypeCode.Int32:
Console.WriteLine("It's an int");
break;
default:
Console.WriteLine("WTF?");
break;
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
|
Hi Friends,
I have MCTS Exam(70-536 & 70-528) Document and Dumps .
I like upload the file to code project.How to upload the file to codeproject
|
|
|
|
|
That's not what CodeProject is for.
Life, family, faith: Give me a visit.
From my latest post: "The themes and truths of the Jewish holidays follow God's complete plan for this world. They are the root from which Christianity sprang and the historical reasons the church had for leaving them behind were unsound."
Judah Himango
|
|
|
|
|
You need to submit a article first, and then you will see how to add a file to codeproject.
|
|
|
|
|
I have created a project which contains a main window form that spawns a series of new windows forms which are Top most application. Upon creation of each new window the focus stays with the current application( Firefox for example) as desired.
The problem occurs after I close one of the spawned windows using (this.close). The spawned form correctly returns focus to the users application which had focus last. However when the next spawn appears, the focus is taken away and given to this program.
Any Ideas?
|
|
|
|
|
Zocrates wrote: Any Ideas?
Are you still operating forms in multiple threads. My example using timers to create and show a second form still never steals the focus from another application like Notepad. I just keep typing into Notepad while my second form appears on top then, on a timer, closes, then appears again, and closes again.
led mike
|
|
|
|
|
I am no longer using multiple threads. When the timer fires and a second form popups up, close this form, but either do not click on the main form, or have it minimized. When the next fires do you retain focus? This is where the problem is.
|
|
|
|
|
Zocrates wrote: When the next fires do you retain focus? This is where the problem is.
led mike wrote: I just keep typing into Notepad while my second form appears on top then, on a timer, closes, then appears again, and closes again.
As I stated, From Form1 I create and show Form2 as TopMost. Form2 has it's own timer and closes itself. This repeats Three times until finally only Form1 is open, all the while I am typing in Notepad.
led mike
|
|
|
|
|
When you say it closes itself does the app close it? I would like the user to close the form when they are done with it.
|
|
|
|
|
Zocrates wrote: I would like the user to close the form when they are done with it.
Ah, I missed that, yes when I close it (the user) then it produces the problem you have reported when it opens the next time.
This appears to be a Windows Forms behavior because I cannot reproduce the problem in my MFC example.
led mike
|
|
|
|
|
This is weird; I'm assigning a Rectangle to another Rectangle, and the width doesn't change:
viewPortInstance.Bounds = layoutSize;
layoutSize is: {X = 0 Y = 0 Width = 800 Height = 400}
Before the statement is executed, viewPortInstance.Bounds is: {X = 0 Y = 0 Width = 1018 Height = 266}
After the statement, viewPortInstance.Bounds is: {X = 0 Y = 0 Width = 1018 Height = 400} ?!
The width didn't change! (layoutSize is the same.) viewPortInstance is a PictureBox.
I also tried:
viewPortInstance.Bounds = new Rectangle (layoutSize.Location, layoutSize.Size); with the same results.
Then when I looked at layoutSize.Size with QuickWatch, the "value" was: "The runtime has refused to evaluate the expression at this time." Excuse me? I didn't know it had a choice in the matter!
Anyone have any idea what's going on?
|
|
|
|
|
Hi,
Try overriding SetBoundsCore of PictureBox. The Bounds property setter isn't always actually changing the values.
Mika
|
|
|
|
|
Thanks Mika; reading the documentation on SetBoundsCore () made me realize that the docking/anchoring properties of the PictureBox are probably what's causing this behavior.
|
|
|
|
|
You're welcome
Mika
|
|
|
|
|
Hi All,
I am using MailTo tag in my application.
I have wriitten a following line of code
hlink.NavigateUrl = "mailTo: ?body=" +
"http://servername/sites/Testsites/Test%20Requests/test.xls";
where hlink is a hyperlink column of the GridView.
When I run the code , I get the following result in the Body of the Email
http://servername/sites/Testsites/Test?20Requests/test.xls
Please help.
|
|
|
|
|
if you mean to add SPACE , did u try
hlink.NavigateUrl = "mailTo: ?body=" +
"http://servername/sites/Testsites/Test Requests/test.xls";
Vikas Amin
My First Article on CP" Virtual Serail Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
I don't want to add space in URL
I want "%" string in my URL .
|
|
|
|
|
I want my URL to be
"http://servername/sites/Testsites/Test%20Requests/test.xls"
I don't want to add space
but in the MailTo tag "%" sign use for space.
I want to treat "%" as a part of the string.
|
|
|
|