|
Hi, yes, as a former Access programmer I had assumed that I could just use the same characters in the filter field of the VS Query designer that I used to use when writing Access queries. As mentioned in my last post on the other thread it seems you just pass the characters as the parameter string rather than trying to make them actual filters.
Thanks for your suggestions.
|
|
|
|
|
What kind of wildcard search are you looking for? If you want it to search for something that begins with the letter A or a, try something like this:
WHERE UCASE(Dam) LIKE 'A%'
If you want anythign that contains an A or a, try this:
WHERE UCASE(Dam) LIKE '%A%'
Hope this helps.
|
|
|
|
|
Thanks for the clue, I've cracked it now. In the SQL query designer in VS2008 you leave the filter as a ? but pass the wild cards to it rather than trying to specify them as the actual filter. The query stays as WHERE Dam LIKE ? etc but in the VB code which calls the query you pass the "%" as the lead and / or tail of the parameter string i.e. "%partial Dam name%".
Thanks everyone for your help.
|
|
|
|
|
HEY EVERYBODY
I HAVE A PROJECT BUILT IN MFC AND NOW I WANT TO PRINT SOMETHING IN CONSOLE INSTEAD OF USED THE WINDOWS.
I HAVE TRIED FOLLOWING CODE BUT NOT WORKING ,,,,,GIVE ERROR........
BOOL CMANDTUApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
AllocConsole( );
// setup stdout
{
int fd = _open_osfhandle( (long)GetStdHandle( STD_OUTPUT_HANDLE ), 0);
FILE* fp = _fdopen( fd, "w" );
*stdout = *fp;
setvbuf( stdout, NULL, _IONBF, 0 );
}
// setup stdin
{
int fd = _open_osfhandle( (long)GetStdHandle( STD_INPUT_HANDLE ), 0);
FILE* fp = _fdopen( fd, "r" );
*stdin = *fp;
setvbuf( stdin, NULL, _IONBF, 0 );
}
// test stdin & stdout
//std::cout << "Console in place. Type a number: ";
/*
int x = 0;
std::cin >> x;
std::cout << "Value read: " << x << std::endl;
// generated code
*/
FreeConsole();
return FALSE;
}
WELCOME ANY TYPE OF ADVICES ,THANKS IN ADVANCE :
|
|
|
|
|
johnjitu wrote: WELCOME ANY TYPE OF ADVICES
TRY A C++ FORUM, THIS ONE IS ABOUT VB.NET!!
And please, don't use all-caps sentences. Shouting is inappropriate.
I are troll
|
|
|
|
|
|
Congratulations, you win moron of the day.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Christian Graus wrote: you win moron of the day.
for not using VB?
|
|
|
|
|
Luc Pattyn wrote: Christian Graus wrote:
you win moron of the day.
for not using VB? OMG
For not using his brain.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi.
To all Code Project members.
Vb.Net related question.
My question is that I have loaded an image in picturebox after that
i have completetly read to this image from pictureBox using getpixel
method. Now i have a big problem that As i am reading a pixel after reading I want to change color of that (point)pixel at pictureBox
coordinates not in image coordinates. So that I could see that i have
read to this pixel from image. and PictureBox is Showing with any
color that pixel has been readed.
Thanks to All.
|
|
|
|
|
You have two issues
1 - you're using a picture box when it's just a layer that gets in the way of what you want to do
2 - you need to convert between the pixel space and the size of the control, which is made harder because you're using a picturebox
Ditch the picture box, draw the image yourself and track the ratio between the image size and size on screen to calculate your mouse position.\
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi I am making a hangman game I am pretty much done with it but I want to add hints in case people are struggling to figure out the word they are working on. It there a very simple way to add these hints?
|
|
|
|
|
Yeah, you write code to do it. Which bit are you stuck on ? What sort of hints do you want to show ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
an example of my code is this
Sub LoadWordArray()
strWordListArray(0) = "ELEPHANT"
strWordListArray(1) = "CARRIAGE"
strWordListArray(2) = "ENVELOPE"
strWordListArray(2) = "ENVELOPE"
strWordListArray(2) = "ENVELOPE"
strWordListArray(3) = "PRESIDENT"
strWordListArray(4) = "ELLIPTICAL"
I want to have when the word elephant is being guessed a box or something that gives a hint to the person guessing that is i a very large gray anamal. You know something like that, it will be different for every word but thats the idea
|
|
|
|
|
OK, so you need to store the hint to go with each word, so probably an array of a struct instead ( word and hint(s) ). Then you need to decide how and when to display them
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Can you give me an example? Like I said I am new at this so I am not really sure what you mean. Thank you
|
|
|
|
|
What Christian means is instead of using a string array that you now have to store your words, create a structure that contains both the word and a hint string, and make an array of that structure.
HTH
|
|
|
|
|
Well, I gave you all the keywords you should need. Do you not know how to create a class or a struct ?
class HangmanWord
{
public string word;
public string hint;
}
is fine.
Beyond that, your task is not specific enough to give any sort of hint. You need to decide when and how to show a hint.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
another best simple way is to do a array with 2 dimensions:
strArray(1,1)= "Elephant", ""A Large Big Grey Animal"
then you assign it to you output to display the Hint(which will be your second dimension)
|
|
|
|
|
The error I get is "Timespan can not be converted to a string".
I did a lot of reading and experimenting on this problem.
My weakness is not understanding the methodology of timespan and parse-ing.
--------------------------------
Public Class Form1
Dim NowIs As Date
Dim NowWas As Date = Now
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
NowIs = Now
TextBox1.Text = NowIs - NowWas
NowWas = NowIs
End Sub
End Class
--------------------------------------
The idea is for the text box to indicate the amount of time passed, in minutes.
Hours could elapse between events.
Thanks in advance to all those who help.
Steve B.
modified on Thursday, April 23, 2009 5:00 PM
|
|
|
|
|
Your problem lies at this line:
Laser Steve wrote:
TextBox1.Text = NowIs - NowWas
When you subtract two Dates, you get a TimeSpan structure. TextBox1.Text is a String type. TimeSpan and String aren't directly equatable. If you want to get the TimeSpan in minutes, use this instead:
TextBox1.Text = (NowIs - NowWas).TotalMinutes
It's really messy (if something goes wrong creating the TimeSpan, you get an ugly error. It also looks ugly), but it works. If you want to learn more about date and time, look into these links:
TimeSpan documentation
DateTime documentation
Date and time format strings (used in parsing methods as well as formatting, so these are important)
|
|
|
|
|
Hi, I have example here on how to get the difference of date and time in C#.
Please follow these step:
Step: 1
Create a timer then set the interval to 10 and enabled to true.
Step: 2
Create 3 Label. Label1,Label2,Label3.
Step: 3
Create 2 Datepicker. Name it dtfrom and dtto.
Step: 4
Create a Button1
Then Copy this Code at your form:
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{label1.Text = dtfrom.Value.ToString();}
private void timer1_Tick(object sender, EventArgs e)
{label2.Text = string.Format("{0:G}", DateTime.Now);}
private void button1_Click(object sender, EventArgs e)
{
TimeSpan ts = new TimeSpan();
DateTime dt1,dt2 = new DateTime();
dt1 = dtfrom.Value;
dt2 = Convert.ToDateTime(label2.Text);
ts=dt1.Subtract(dt2);
label3.Text = ts.ToString(); //Answer
}
for more information visit this: <a href="http://codeincsharp.blogspot.com/2008/05/how-to-get-date-and-time-difference-in.html">http://codeincsharp.blogspot.com/2008/05/how-to-get-date-and-time-difference-in.html</a>[<a href="http://codeincsharp.blogspot.com/2008/05/how-to-get-date-and-time-difference-in.html" target="_blank" title="New Window">^</a>]
|
|
|
|
|
Try This:
Public Class Form1
Dim NowWas As Date = Now
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = Now.Subtract(NowWas).TotalMinutes.ToString
End Sub
End Class
|
|
|
|
|
Try TextBox1.Text = Convert.ToString(NowIs-NowWas)
|
|
|
|
|
how can i go from the last item in a combobox to the first item.
With the folowing code i go always to the second item.
Private Sub ComboBox1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ComboBox1.MouseWheel
Dim x As Integer
x = ComboBox1.SelectedIndex.ToString
If x = 95 AndAlso e.delta = -120 Then
ComboBox1.Text = ComboBox1.Items(0).ToString()
End If
End Sub
so i tried a lot of things but i gives me always the second item.
thanks.
|
|
|
|