|
OK, so time is not that big a deal, but perhaps big enough that either way, your way makes more sense ( the static constructor )
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Gotcha.
Just a little quickie ... I get a warning on this line:
if (_fileExt == ThisRow[0])
Possible unintended reference comparison; to get a value comparison, cast the right hand side to type 'string'
I know that ThisRow[0] column contains a string, so it is safe to carry on without the .ToString()? As I understand it casting has an overhead that in this instance is not needed?
Thanks,
James.
|
|
|
|
|
I would obey the warning. A reference comparison means that you're checking if they are both the same string, not two strings with the same value. Big difference.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Not sure I follow, isn't this:
foreach (DataRow ThisRow in BuildLookups.dsExtensions.Tables["ext_look_up"].Rows)
{
if (_fileExt == ThisRow[0].ToString())
just saying foreach row in this table keep iterating until this string == (is the same as) the contents of ThisRow[0] (column 0)?
|
|
|
|
|
Well, you can cast it instead of calling tostring. Until you cast, it returns an object, so it compares the two objects to see if they are the same object. _fileExt and thisRow[0] may have the same value, but be different objects, different string instances.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
gotcha!
I know this is really cheecky but you've been so helpful in my endeavours to get my head into this I was wondering if I could ask a HUGE favour?
I don't feel confident in the general structure of what I'm doing in my app in terms of scope. I've just run into a scenario where I have a need for one of the lookups in the presentation layer but as I'm now building those in the data layer as you described they aren't available to the presentation layer.
feels like a huge 'gotcha' in a catch 22. Its a tiny app at the moment but would you be up for doing a brief code review if I emailed it to you?
Just some pointers on my 'coding myself into a corner' situation and wotnot. There are probably features of the language I've never encountered or heard about that would be the fix I'm looking for but I can't even ask questions about them as they are out of my field of vision.
Of course you can tell me to sling my hook!
James.
|
|
|
|
|
You can email me the code if you'd like, but I don't know how soon I'd have time to look at it. christian dot graus at gmail dot com
The best solution probably is to expose a method on the data layer that does the lookup you're after, but keep the data itself in the data layer.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Jammer wrote: I can't "foreach" over a dataset can I
No, and I'm still on .NET 2.0 but you can foreach over the rows in the tables in the DataSet.
led mike
|
|
|
|
|
hehe ... I just spotted my mistake in the code ... man, every time I reach for codeproject I say something daft and then after 30 seconds or so go ... "er ... ahhhhh" ...
|
|
|
|
|
Oh man I hate this error ...
"Object reference not set to an instance of an object." on this line:
foreach (DataRow ThisRow in BuildLookups.dsExtensions.Tables["ext_look_up"].Rows)
Whats the quickest way to actually debug issues like this. I always find myself getting a little confused by this one.
|
|
|
|
|
hmm ... my way doesn't seem to work ... i'm going to try this inside the same class that i'm using them in rather than having public instances of the lookups ... it doesn't seem to work they I tried.
all this failure can get a bit much sometimes ...
there are some really basic structuring things I still don't get about sharing things between classes that I'm sure is making my code a speghettification of logical hiccups ...
|
|
|
|
|
I've created a class that I want to turn into a UserControl but it has no need to be physically visible on the form - like the BackGroundWorker for example, it should only reside in the bar beneath the form in the IDE.
How do I do this?
Dave
|
|
|
|
|
You can add a background worker thread in the UI designer ? I find that pointless, why add it if it's not visible on the form ?
I guess you should look at how the background worker does it. My guess would be that there's an attribute on the class, if it's not derived from the Control classes, that makes it appear in the designer.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
There are several controls that behave like this. All the entries under the Components heading and Dialog heading in the toolbox at least. Adding/being visible in the designer is useful as the Properties Window is then available plus you can see what objects have already been created in InializeComponent().
Still haven't managed to figure this one out but I'll persevere.
Dave
|
|
|
|
|
Just got it!
The class needs to inherit from System.ComponentModel.Component instead of UserControl or Control
Dave
|
|
|
|
|
I am trying to create a UI for my DirectDraw interface that replaces the getto Today screen in Windows Mobile 6. I am using C# managed code to develop the interface.
I realize that there is something called DXUT in the .Net framework that provides functionalty of a UI elements such as a UI Button. Is there such thing for the mobile framework?
If not, I will have to implement my own button. How do i raise an event that checks if the mousetap is within bounds of a button? Do i actually have to implement the code to continously check if the mouse is inside the bounds of the button? Would that cause a high cpu utilization? Some kind of threading? please advice
|
|
|
|
|
hi,
i'm only starting with SQLServer 2005
the Questiuon is:
i have an app (C#) that is a client(in two computers for now).
Do i need to Create some sort of a Thread the will
Re Fill my dataset or does it's managed by the server
or maybe there's an Event that raises every time a Change is made
???
i'm confused
THANKS
Have Fun
Never forget it
|
|
|
|
|
You don't need to create special threads. There is no event in your application when a database change occurs. Your client app cannot tell when the database is changed unless you build your own system that informs all clients.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
So you're saying that i need in the SQLSERVER himself
some kind of an Event or ... to inform the clients
can u refer me to an article about it?
i've got lost searching in google and here
THANKS
Have Fun
Never forget it
|
|
|
|
|
No, I'm saying it doesn't work that way. You'd need to have the client that updates a table to send a broadcast message. Or, SS2005 lets you run .NET code, you may be able to do something with a trigger and a .NET class that sends a message in some way. Typically, tho, databases have never worked that way, it's never been the case that your client app can get a message to say that the DB has changed.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: SS2005
yep i have it
and thanks a lot
i'll try to dig in further
Have Fun
Never forget it
|
|
|
|
|
Maybe you could have a look at the SQLDependency-class, too. It's another way to inform your app that sth. changed on a specific table in your SQL Server 2005 database.
|
|
|
|
|
I have a small form for trying to record but I can't get it to work properly.
I have the code below and I can record and play the created file in this application and other media players. The code creates a 8bit 11kHz mono.
The problem is when I try to use the "set" parameters, any of them, then I can only play it back in this application, not with any other players.
Am I doing something wrong?
using Microsoft.VisualBasic.Devices;<br />
using Microsoft.VisualBasic;<br />
using System.Runtime.InteropServices;<br />
using System.Windows.Forms;<br />
<br />
namespace Recorder<br />
{<br />
public partial class Form1 : Form<br />
{<br />
[DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]<br />
private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void buttRecord_Click(object sender, System.EventArgs e)<br />
{<br />
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);<br />
<br />
mciSendString("format tag pcm", "", 0, 0);<br />
mciSendString("set recsound channels 2", "", 0, 0);<br />
<br />
mciSendString("record recsound", "", 0, 0);<br />
}<br />
<br />
private void buttSaveStop_Click(object sender, System.EventArgs e)<br />
{<br />
mciSendString("save recsound c:\\record.wav", "", 0, 0);<br />
mciSendString("close recsound ", "", 0, 0);<br />
Computer c = new Computer();<br />
c.Audio.Stop();<br />
}<br />
<br />
private void buttPlay_Click(object sender, System.EventArgs e)<br />
{<br />
Computer computer = new Computer();<br />
computer.Audio.Play("c:\\record.wav", AudioPlayMode.Background);<br />
}<br />
}<br />
}
|
|
|
|
|
I have a web application which i installed it on a computer, now i had some changes in the application and want to add a version number to the MSI file. Hou can I do that? IS there anything provided in microsoft documentation?
thanks
robust
|
|
|
|
|
The app version number is stored in the app.config file, I believe. But when I build an MSI, I put the version number in the title.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|