|
Can anybody confirm what the correct syntax is for using the #ifdef DEBUG statement is?
I am attempting to do something like this:
private bool CheckLogon(string username, string password)
{
#ifdef DEBUG
return true;
#endif
...
snipped code that does release logon checks
...
return checkLogonResult;
}
However this gives a preprocessor directive compiler error.
According to google the syntax above is correct, so I must be committing some stupid mistake
|
|
|
|
|
use #if instead of #ifdef. #ifdef is a C++ directive, not C#.
Josh
|
|
|
|
|
The shame of it
Thanks though
|
|
|
|
|
You beat me to it
Sincerely,
Alexander Wiseman
|
|
|
|
|
|
Hi MrEyes,
If you are using C#, I think the correct way to do this is as follows:
#if _DEBUG
return true;
#endif Your Google search probably returned results which work in C++, but not in C#, unless I am mistaken.
Let me know if that works out.
Sincerely,
Alexander Wiseman
|
|
|
|
|
I need to detect type of network connection that current active on computer (including the IP Address of that connection). I have computer that have two type connection Dialup and LAN (using LAN card). Now I want to know that both connection active or not, because I meet some sample that must send WebRequest to know a network connection that exist or not.
Beside that, if we can detect the Dialup (on LAN card also). How we can know the IP address that received on Dialup, we know that Dialup use DHCP service and the IP address dynamic.
That's all. Thanks for answering.
Regrads,
Ariston Darmayuda.
Simple mind programmers, I don't need a complicated mind.
|
|
|
|
|
This is my code for drawing a set of 8 circles:
private void tbInputTest_Paint(object sender, PaintEventArgs pe)
{
//Get the Graphics object
g = pe.Graphics;
//Create an array of rectangles
Circles = new RectangleF[8];
for (int i = 0; i < 8; i++)
{
Circles[i] = new RectangleF(310, 30+(i * 40), 30, 30);
g.FillEllipse(Brushes.White, Circles[i]);
g.DrawEllipse(Pens.Black, Circles[i]);
}
}
I have a button that when pressed will update the fill color of one of the circle. how i do that? I mean how to propagate the graphic handle toward the whole program. by the way the circles appear on a tab control which make thing not that easy.
Donkaiser
|
|
|
|
|
Use the Invalide method of the control to make it redraw itself.
---
b { font-weight: normal; }
|
|
|
|
|
which invalid method? do u have an example?
Donkaiser
|
|
|
|
|
anyControl.Invalidate();
// If you need an immediate redraw...
anyControl.Update();
// Alternatively, if you're lazy and always want an immediate redraw...
anyControl.Refresh();
Josh
|
|
|
|
|
oh i see. so each time i wanna update sth i need to refresh the display. i thought the paint event keep running in the background. anyway i was trying to implement this:
button1_click(....event e)
{
g.FillEllipse(Brushes.Red, Circles[3]);
g.DrawEllipse(Pens.Black, Circles[3]);
}
g is global type Graphics;
Circles is global type RectangleF[];
but it gave me that i have invalid parameter. why? Please refer to my original code for the on paint code.
Donkaiser
|
|
|
|
|
'g' has probably been disposed of after your Paint event handler is called. Instead of caching the Graphics object you receive in the Paint handler, try calling CreateGraphics() on the TabPage in the Click handler (be sure to call Dispose on that Graphics object when you're finished with it). Draw with that Graphics object instead.
Josh
|
|
|
|
|
donkaiser wrote: i thought the paint event keep running in the background.
No, the paint event is only called when it's needed. If it was running constantly, it would use a huge amount of cpu, and the display would flicker.
---
b { font-weight: normal; }
|
|
|
|
|
Hi world !
I have a strange need today : create an Excel file without Microsoft Office installed on computer.
I work on a WinForm application wrote in C# using .Net 1.1.xxxx.
> I need to be able to create a new .xls file, with some data generated in a progamm loop
> I also need to set the BackGround color for some cells
And the generated file must be directly openable in Excell ( with a double click for exemple : the file is a valid .xls file )
I've think about XML format, but cannot found full description to allow cells BackGroundColor custom.
Thanks in advance if someone have a genius idea ! ...
PS: Sorry if this post isn't in the correct forum ...
Have a nice day.
Sebastien.
|
|
|
|
|
You could look at the open office source for information about how the .xls binary is structured. Good luck. From what I've heard the office binary formats are full of nasty gotchas.
|
|
|
|
|
That's a good idea ! Thanks
... maybe someone have ever write a dll, or ?!
I think browse OpenOffice source code is a big task !!!
Arrghhhh ... Life is hard ...
|
|
|
|
|
I've never used this thing[^] but it looks like it does what you need. Don't yell at me if it sucks!
Josh
|
|
|
|
|
I want to, after deployement of the application, modify the resources of my application. Let say you have a windows form with a button that has a name but you want the user to have the posibility to modify it. Since resources are compile in dll, it is a bit tricky. I have explore two possibilities:
1- I've tried to implement my own resource manager that I would replace in my form where as :
System.ComponentModel.ComponentResourceManager resources = myresourcemanager;
The ComponentResourceManager inherit from ResourceManager and add the ApplyResource method. I can easly derive from ComponentResourceManager, but I have a hard time changing the ResourceManager that it derive from.
I would like to modify only one line of code since it is in the Designer class. And that would leave me the IDE functionnality to generate resources.
I found this article : http://www.codeproject.com/aspnet/customsqlserverprovider.asp that is nice but is for asp and I'm missing information to fill the gap.
2- Uses uncompile resource at runtime that I would be able to modify. I found somewhere that it is possible with asp but didn't find much information about it.
Any ideas?
Thanks
-Archambault
-- modified at 11:59 Thursday 15th June, 2006
|
|
|
|
|
Hi,
When using webservice, I have the time like that:
"2006-06-15T12:10:09Z"
I can't understand it? Is it universal time? "T" & "Z" mean?
Thanks for your help!
Hung
|
|
|
|
|
T is apparently a delimiter between the date and time. Z stands for Zulu which is an alternate name for universal time (UTC), and practically equivilant to GMT. There are a few differences between UTC and the older GMT standard but unless you're a clock geek they're meaningless.
|
|
|
|
|
Hi,
What are a few .Net data structures let you manipulate several objects of data through a single variable name ?
Name at least 1 in both the System.Collections namespace and System.Data namespace. How do you choose when to use one of these, or an Array for example ?
Thanks in advance
|
|
|
|
|
Open your textbook. I'm sure those answers are readily available, since this sounds like a really easy question on homework.
2 things:
1) Read the sticky at the top, it will help you get answers.
2) To elaborate, had you posted this exact question, but followed it with what you thought the answer was, and what you were having problems conceptualizing (Like trying to come up with situations when you would use one data collection object or another, with examples), I'm sure you probably would have gotten a few answers to try and help you understand things better. I (and I'm not sure I speak for everyone, but I definetely speak for myself) am glad to help to people who it seems have put work into their efforts so far.
|
|
|
|
|
I can perfectly call a new web page from a Hyperlink control inside a DataList control and pass two values to it by using this code:
___________________________________________________________
...
<asp:DataList ID="promotionlist" Runat="server" >
<ItemTemplate>
.
.
.
<asp:HyperLink ID="HyperLink1" Runat="server" NavigateUrl='<%# "../NewWebPage.aspx?Title=" + Eval("Title") + "&Price=" + Eval("Price") %>'>
<img width="74" height="24" src="Images/newwebpage.gif" border="0"/>
</asp:HyperLink>
.
.
.
</ItemTemplate>
</asp:DataList>
...
___________________________________________________________
But the problem with that is that it replaces the current web page ( web form ) which defeats my purpose.
I need the new page to appear in a (((pop-up window ))) and also receive the values “Title” and “Price” that are received through the “Eval()” function.
I did not find any C# function like the javascript one ( window.open()) so I tried an inline javascript code with inline C# insertions but it does not work.
I am not sure if the culprit is the syntax or it is impossible to concatenate strings in inline javascript with values obtained by inline C# code like (<%#Eval("Title") %>).
I would be grateful to whom could suggest a simple and elegant solution or correct the syntax of my code.
Here is my current tentative code ( it does not work ):
__________________________________________________________
…
<a href='' onclick = "window.open('NewWebPage.aspx?Title='+<%# Eval("Title") %>+'&Price='+<%# Eval("Price")%>)">
<img width="74" height="24" src="Images/newwebpage.gif" border="0"/>
</a>
..
___________________________________________________________
|
|
|
|
|
Can you open the window through normal Javascript, and put the values for title and price in Session.
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|