|
The point was made, but was it taken to heart? If so, then job done and we can all put this behind us.
|
|
|
|
|
I am so enjoying reporting each of your messages as abuse...
Blog link to be reinstated at a later date.
|
|
|
|
|
After a user successfully inserts a new record in the "DetailView" control, I want to redirect them to a new page. Is the best method of doing this as follows:
protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
{
Response.Redirect("Part2.aspx");
}
|
|
|
|
|
|
This is in two forums; question above is in three.
Blog link to be reinstated at a later date.
|
|
|
|
|
Hey everyone,
I'm trying to use an enum. But I don't use this a lot and I'm now at a point where I don't understand it anymore.
I have this code:
enum frequency
{
Second,
Minute,
Hour,
Day,
Month,
Year
}
public constructor()
{
comBoxFrequency.Items.Add(frequency.Second);
comBoxFrequency.Items.Add(frequency.Minute);
comBoxFrequency.Items.Add(frequency.Hour);
comBoxFrequency.Items.Add(frequency.Day);
comBoxFrequency.Items.Add(frequency.Month);
comBoxFrequency.Items.Add(frequency.Year);
}
public void buttonClick()
{
switch (comBoxFrequency.SelectedText)
{
case frequency.Second:
break;
case frequency.Minute.ToString():
break;
case frequency.Hour:
break;
case frequency.Day:
break;
case frequency.Month:
break;
case frequency.Year:
break;
}
}
As you see I get two errors: Cannot implicitly convert type '___.frequency' to 'string'
And if I make a string of this: A constant value is expected
Does anyone know how to work around this problem (or what I do wrong)?
|
|
|
|
|
Deresen wrote: switch (comBoxFrequency.SelectedText)
use switch ((frequency)comBoxFrequency.SelectedValue) instead
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Yes it did help!
Thank you very much.
Now I can throw my if()____else if()___else if() (ugly code) away.
|
|
|
|
|
you're welcome
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
You can also take a look at this article[^] for some alternative ways to do this.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Hi all,
I hope you can help me with the following problem:
I have a third party COM Object written in c++.
I have a VS 2003 C# Project (1.1) that accesses this object (via "Add Refernence To Com Object...")
Everything works fine!!!!
Now I want to access the COM Object from a C# VS2008 Project (3.5).
In the VS2008 project I get an Exception saying that it is not possible to cast the Object
to the desired type. The functions only return __ComObject.
I tried Marshal.CreateWrapperOfType(), but no success.
Do you have any idea what I can do??
Thanks in advance
Jens
modified on Wednesday, October 22, 2008 12:14 PM
|
|
|
|
|
Hi all .
I Wount to Learn Shair Point , But I do Research On the Enter Net About Books For Shair Point ,
But I dont Found Free Books About it .
Who Can Give Me Address For Web Application Allow To me Download Books About it ?
Thanks For Any body heelp me
Thaer
|
|
|
|
|
Hi,
a quick google search came up with a blog entry about a free sharepoint eBook:
Click here
regards
Sebastian
|
|
|
|
|
Hi all,
I need help in converting a delimited text file as follow into a database file so that i could use sql commend to select and view the column that i wants to view. but i am stuck in converting the file pls help, i am using 2005 C# for my programming.
My delimited text file:
Time Locked CBER Quality VBER Strength SNR Uncorrectable
03:08:45.655 T 1.0E-003 64 1.6E-003 -17 18 1143
.655 col start @ 1st tab
Locked col start @ 2nd tab
CBER col start @ 3th tab
Quality col start @ 5th tab
VBER col start @ 7th tab
Strength col start @ 9th tab
SNR col start @ 11th tab
Uncorrectable col start @ 12th tab
the tab mean the delimited spacing of each column within a row. Pls direct me if i m wrong, what i need is to convert this file into a database file for better storing and selection to view the col of info i want thanks.
|
|
|
|
|
Hi,
so you already made half of the way. If you know the format of the file, so what's left is:
1) Read the file line by line.
2) Split each line (could be done with line.Split('\t')) to get an array corresponding to your columns.
3) Put the values in a sql command and execute it.
Oh missed point 0) Set up the database.
Regards,
Sebastian
|
|
|
|
|
Some databases support this operation. You should consult your database documentation. In SQL Server they have Bulk Insert[^]
led mike
|
|
|
|
|
That mean i need to create a table? sorry i am new in C# programming
|
|
|
|
|
Hook up!!!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hmm. Getting replies today that I just don't understand. Guess I picked a bad day to stop smoking crack.
led mike
|
|
|
|
|
We've discussed this before...."Hook up!" is yelled when a big game fish
(tuna, yellowtail, wahoo, etc.) grabs a lure while trolling from a sportfishing
boat.
Judging by the OP's reply above, you've been hooked
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: We've discussed this before...."Hook up!"
Ah yes, now I remember. At least now I understand your reply.
led mike
|
|
|
|
|
A simple newbie question about interfaces if I may.. Should I be able to do the following:
ClassA classA = new ClassA();
IClass iclass = (IClass)classA;
ClassB classB = (ClassB)iclass;
Assuming both ClassA and ClassB implement IClass. I get an InvalidCastException (which may answer my question) but thought I should be able to do it? Thanks
|
|
|
|
|
Hi,
well I think this is not working because the iclass-reference points to an ClassA object and not to an ClassB object. So it's correct that you get an InvalidCastException.
Was this helpful?
Regards
Sebastian
|
|
|
|
|
No you shouldn't.
I'll go through your code line by line and explain what is happening.
This line creates a new object of type ClassA and assigns it to the classA variable
ClassA classA = new ClassA();
This line takes that ClassA object and casts it into a IClass type variable. Note that the object itself is still a ClassA object, it's just being stored in a variable that is IClass
IClass iclass = (IClass)classA; Now you have an IClass object, you can only call methods on it that are part of that interface. You can't call ClassA specific methods on it, but it is still a ClassA object, so when you call those IClass methods, they are routed to the ClassA definitions for execution.
What you are trying to do here is cast an IClass object as a ClassB object. but the object isn't of type ClassB, it's of type ClassA, so the cast fails
ClassB classB = (ClassB)iclass;
This would work, because the object is a ClassA object, so can be cast as such.
ClassA aAgain = (ClassA)iclass; What your doing is like taking an apple, putting it in a box that is labelled "fruit", then trying to take the apple back out of the box and claim it is now an orange. Casting doesn't ever actually change the underlying type.
By the way, you don't actually need the first cast. because ClassA already inherits from IClass, you can just do the assignment without casting
IClass iclass = classA;
Simon
|
|
|
|
|
I like this one:
Simon Stevens wrote: What your doing is like taking an apple, putting it in a box that is labelled "fruit", then trying to take the apple back out of the box and claim it is now an orange.
Should remember this for next time explaining casts...
|
|
|
|