|
If you are going to continue to answer your own questions I'm going to have to get your message count adjusted or something.
Glad you could be of service to yourself - oops that could be a vision I could do without!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: If you are going to continue to answer your own questions I'm going to have to get your message count adjusted or something
I just thought it's rude to delete a question when I find the answer so instead, I post the answer! Besides, why would I care to have my message count go higher??
Mycroft Holmes wrote: Glad you could be of service to yourself - oops that could be a vision I could do without!
Ha ha ha! Good one though
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Your right, it is much better to post your solution rather than delete the post.
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
It wasn't your IDE, you're just missing a "+ " sign after the select statement, that's why intellisense didn't know how to parse your line. You can also omit the == true comparison if you like.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
That's poor programming practice. You should contain the comparison in parens, like so:
String strSelectStatement = "SELECT EMP_NAME FROM EMPS WHERE EMP_TYPE =" (MyCheckBox.Checked == true) ? "1" : "0";
Or, you could use string.Format:
string strSelectStatement = string.Format("SELECT EMP_NAME FROM EMPS WHERE EMP_TYPE ={0}", (MyCheckBox.Checked == true) ? "1" : "0");
Or, you could use the StringBuilder class:
StringBuilder sql = new StringBuilder("SELECT EMP_NAME FROM EMPS WHERE EMP_TYPE =");
sql.Append((MyCheckBox.Checked == true) ? "1" : "0");
No matter how you do it, you should enclose the comparison with parenthesis...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
hi
i was designed a new TableAdapter in Viusal Studio 2005 DataSet Designer(add new table and set it's CRUD command with Stored Procedures), the first column of table is pk and identity, my problem is that the insert method parameters is :
t1TableAdapter.Insert(ref int? id,int? number,string name)
first question : what is '?' ?
second question : when i insert my record by following code :
int id = -1;
int number = int.Parse(this.textBox2.Text);
string name = this.textBox3.Text;
this.adapter.Insert(ref id, number, name);
the following error message has shown me :
The best overloaded method match for 'DataAccessDesigner.DsMyDbTableAdapters.t1TableAdapter.Insert(ref int?, int?, string)' has some invalid arguments.
Argument '1': cannot convert from 'ref int' to 'ref int?'
how to solve it ?
---------------------------------------------------------------------------------
another problem is that when i declare id as int? instead of int, like this :
int? id = -1;
int number = int.Parse(this.textBox2.Text);
string name = this.textBox3.Text;
this.adapter.Insert(ref id, number, name);
this.button1_Click(null, null);
it compile and when i insert a new record, the stackOverFlow exception has occuerd, why ?
thanks
modified on Saturday, September 13, 2008 5:29 AM
|
|
|
|
|
Hi,
Any idea how can you get the icon of an exe or dll file?? say from %windir%system32\SHELL32.dll
I dont know how to do it but I'm sure C# can do it
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
modified on Saturday, September 13, 2008 4:09 AM
|
|
|
|
|
|
Hi all,
We have requirement of generating Graphs using xml with crystal reports.
Please kindly suggest me how to do that.
Thanks inadvance
cheers,
sekhar
|
|
|
|
|
use dataset to read xml, and use that as datasource for your crystal report
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
hi
i have c++ code which i want to change it to the c# code,i must using pointers,
can i change below code to the c# ?
int *p1,*p2;
int i=0;
p1=&i;
*p1=100;
p2=p1;
|
|
|
|
|
You can use an unsafe block.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Although there are softwares for this purpose, my aim is to create a windows application which will simply show cpu temperature
for the time intervals I give in , and will display no other options (such as voltage,etc.. which are going to consume computer resources (cpu,ram)). I want it to be simple : just a label of cpu temperature (as I'm having a problem with my cpu temp.)
I've searched the net and find something about the Management Class, but couldn't retrive the temperature..
I guess it should be two or three lines of code to obtain it and I'd be glad to get your help.. thanx
|
|
|
|
|
Here's a silly example of one way to use WMI to display processor info.
This uses the WMI Win32_Processor class, but the
Win32_TemperatureProbe Class[^] class could be used.
Seems most hardware doesn't support it though.
Doesn't hurt to try it.
int ProcessorIndex = 0;
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
ManagementObjectCollection.ManagementObjectEnumerator enumerator = searcher.Get().GetEnumerator();
while (enumerator.MoveNext())
{
Console.WriteLine("ProcessorIndex: {0}", ProcessorIndex++);
if (null != enumerator.Current["Name"])
Console.WriteLine("Name: {0}", enumerator.Current["Name"].ToString());
if (null != enumerator.Current["Description"])
Console.WriteLine("Description: {0}", enumerator.Current["Description"].ToString());
if (null != enumerator.Current["NumberOfCores"])
Console.WriteLine("NumberOfCores: {0}", enumerator.Current["NumberOfCores"].ToString());
if (null != enumerator.Current["NumberOfLogicalProcessors"])
Console.WriteLine("NumberOfLogicalProcessors: {0}", enumerator.Current["NumberOfLogicalProcessors"].ToString());
if (null != enumerator.Current["L2CacheSize"])
Console.WriteLine("L2CacheSize: {0} KB", enumerator.Current["L2CacheSize"].ToString());
if (null != enumerator.Current["L2CacheSpeed"])
Console.WriteLine("L2CacheSpeed: {0} MHz", enumerator.Current["L2CacheSpeed"].ToString());
if (null != enumerator.Current["L3CacheSize"])
Console.WriteLine("L3CacheSize: {0} KB", enumerator.Current["L3CacheSize"].ToString());
if (null != enumerator.Current["L3CacheSpeed"])
Console.WriteLine("L3CacheSpeed: {0} MHz", enumerator.Current["L3CacheSpeed"].ToString());
if (null != enumerator.Current["LoadPercentage"])
Console.WriteLine("LoadPercentage: {0}", enumerator.Current["LoadPercentage"].ToString());
Console.WriteLine("------------------------------------------");
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi there.
I want to convert each node and child node in treeView.Nodes to contextMenuStrip's items !
Do you have any suggestions ?
Thank you.
|
|
|
|
|
Hello. I've got a little problem I've been having a hard time solving.
I'm trying to use the web browser control on a windows form to get the html of a frame that the given page contains. I can't just simply use the url of that inner frame, because with each login to this site it has an appended session ID on the url and other such a=b&c=d&e=f nonsense that changes from session to session. Digging through google I found mention of webBrowser1.Document.Window.Frames[0 /*or any other index for that matter, but in my case there is only 1 element*/ ].Document.Body but this threw a System.UnauthorizedAccessException when I tried it.
Ultimately, what I'm going for is a rather simplistic project but it's giving me fits on this point. I'd like to be able to login on this form on ogame.org and have it refresh every five minutes, searching the contents of "mainframe" for the word "hostile" - and if this is found, sound an alarm (system speaker et all), as this would mean one of my planets has an incoming attack, and I know how to do all of this except getting the damn mainframe's source. I know it shouldn't be too hard to do - in my opera browser I can just right click, go to the frame menu, and open it up just fine, and that's the source I want! but I can't get this out of my web browser control. all I can get is--
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict //EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta name="author" content="Gameforge Productions GmbH" />
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<meta name="keywords" content="META_KEYWORDS" />
<meta name="description" content="META_DESCRIPTION" />
<meta name="robots" content="index, follow" />
<meta name="language" content="en" />
<meta name="distribution" content="global" />
<meta name="audience" content="all" />
<meta name="author-mail" content="info@ogame.de" />
<meta name="publisher" content="Gameforge Productions GmbH" />
<meta name="copyright" content="(c) 2007 by Gameforge Productions GmbH" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<title>OGame.org</title>
</head>
<frameset rows="*,0,0" frameborder="no" border="0" framespacing="0">
<frame name="mainframe" src="home.php" frameborder="0" scrolling="auto" noresize>
</frameset>
</html>
<script>
frame = document.getElementsByName['mainframe'][0];
if ( typeof( window.innerWidth ) == 'number' ){
if (window.innerWidth <= 800){
frame.scrollbars.visible=true;
}
}else {
if (document.body.clientWidth <= 800){
frame.scrollbars.visible=true;
}
}
</script>
[/code]
--from the top level page.
If anyone knows a thing or two about this windows control and is able to help me I'd be really grateful. I've been working on this all day and can't get it to work because of this one, single problem.
Thanks!
-Gatsby
|
|
|
|
|
Hi
I am trying to pass data back and forth windows forms but I am having trouble. What I am trying to do is this:
I have a mainForm that has 2 textboxes called plainText and ChiperText. This main form also has a menu bar of different algo to choose from(for instance shift Chiper).
When shift chiper is clicke id launched a new form(shiftchiper.cs). It has some options and it also have a toolbar with Encrypt and decrypt.
When encrypt is hit I want to take the data from mainForm PlainText textbox and encrypt it. Once encrypted send it back to the mainForms chiperText box.
If they hit decrypt it's the same thing just reversed.
By using this tutorial( I used the property way)
http://www.codeproject.com/KB/cs/pass_data_between_forms.aspx
I been able to send the PlainText data to the shiftChiper form and encrypt it. What I can't do is send the new encrypted data back to the ChiperText textbox in the mainForm.
So anyone know how to do this?
I simple example would be nice. It can be just 2 textboxes on one form and a button. when the button is clicked a form2 is made and it sends over one of the textboxes. One form2 it can have a button when clicked it sends the data that was sent back to form1.
I am doing it in C# by the way.
|
|
|
|
|
I think I know what you're talking about. let me see if I can help.
Anything in public access space on the popup can be accessed by the main form from wherever the instance of the popup is.
For example. on my main form named form1 I have a button that opens a popup named form2. in the button click event on form1's button I'd have something to the effect of
PopupFormTypenameGoesHere form2 = new PopupFormTypenameGoesHere( params to send et all)
form2.ShowDialogue();
Text = form2.someInfo;
and in form2's close event I'd have
someInfo = "hello world"; // or whatever
This would cause form1's title (ie it's Text property) to be set to "hello world" after the popup had closed (or whatever someInfo was set to in that form)
I hope that helps.
One thing you should be careful with is the usage of Show() and ShowDialogue() - they are NOT interchangeable.
-Gatsby
|
|
|
|
|
do you need to use 2 forms? is there a critical reason? i don´t see it.
i use (1) parent form/child form method or (2) the form + userforms (loaded in form) method
but i don´t see how you can get it to work, i assume you did the same in both forms. i think it´s because the first owes the second. Are you using delegates?
check articles here on those methods, you won´t get errors and look nicer
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Envents and/or delegates are the answer.
I posted a delegate sample here[^] previously.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Hi,
I am trying to use DGVComboBoxColumn. I googled but didn't find any solution for below issue.
When I click on the DropDown it shows me DisplayMember i.e State name but after selecting one of them when I click somewhere outside, it displays ValueMember i.e Id of the state.
Please can anyone help me? Below is the code to load the State in DGVComboBox.
void LoadState()
{
try
{
dtState = GetState();
dgvCmbState.DataSource = dtState;
dgvCmbState.ValueMember = "Id";
dgvCmbState.DisplayMember = "sName";
}
catch (Exception ex)
{
}
}
Thanks
|
|
|
|
|
Hi there.
How can we find WindowState changes?
Is there an event for that ?
Thanks in advance.
|
|
|
|
|
Depends on what window state change notifications you need.
The Form class from the System.Windows.Forms namespace has some very common ones, like:
- Shown
- StyleChanged
- SizeChanged
- ResizeBegin
- ResizeEnd
- VisibleChanged
and some more. If you need to capture all changes, then you could derive your own Form from Form and handle the underlying WinAPI WM_ messages yourself.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thank you Greeeg.
Greeeg wrote: Depends on what window state change notifications you need.
Minimize, Maximize, Normal
These were my purpose.
|
|
|
|
|
This[^] should help you
regards
modified 12-Sep-18 21:01pm.
|
|
|
|