|
Hi i have 2 drop downlist box,
in that one i can select year another one month,
if i select the month,that month all dates want to be display in datagrid,
how to do that
Regards,
Magi
|
|
|
|
|
Magh_M wrote: if i select the month,that month all dates want to be display in datagrid,
Using DateTime.DaysInMonth(year,month) you can get the no of days in that month. Put that in a loop and add all to the date dropdown list.
|
|
|
|
|
hi frnds,
i need to implement spell check functionality in windows form for dis
i'm using rich text box as an editor and all functionality of word
bt not able to use spell check.
so if any 1 knows abt spell check coding for win forms plzzz help me
thnxs
|
|
|
|
|
|
I need help to create a scrabble game. can anyone please help me to create scrabble game. i have to do using visual basic language. if there is anyone plase help me............ thats what i have so far but i have to write alot of if statements inorder to specify location.
Public squares(15, 15) As Square
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim k As Integer
Dim irow, jcolumn As Integer
Dim squarevalue As String
Dim mysquare As Square
' Dim box As Integer
Dim i, j As Integer
For irow = 1 To 15
For jcolumn = 1 To 15
mysquare = New Square(irow * 40, jcolumn * 40)
mysquare.SizeMode = PictureBoxSizeMode.StretchImage
mysquare.Name = (irow & jcolumn)
For j = 1 To 15
If irow = 12 And jcolumn = 12 Then
mysquare.Image = Image.FromFile(Application.StartupPath & "\scrabbleboard\TripleWord.jpg")
End If
Next
If irow = 8 And jcolumn = 8 Then
squarevalue = "Star"
mysquare.Image = Image.FromFile(Application.StartupPath & "\scrabbleboard\STAR.jpg")
Else
squarevalue = "BLANK"
End If
mysquare.value = squarevalue
squares(irow, jcolumn) = mysquare
Me.Controls.Add(mysquare)
Next jcolumn
Next irow
End Sub
Public Class Square
Inherits PictureBox
Public value As String
Public Sub New(ByVal x As Integer, ByVal y As Integer)
MyBase.New()
Me.SetBounds(x, y, 40, 40)
If value = "DL" Then
BackColor = Color.AliceBlue
ElseIf value = "star" Then
BackColor = Color.White
ElseIf value = "TW" Then
BackColor = Color.Red
Else
value = "Blank"
BorderStyle = Windows.Forms.BorderStyle.Fixed3D
BackColor = Color.Tan
End If
End Sub
End Class
End Class
|
|
|
|
|
What do you need help with specifically? Having tackled scrabble a while back I know most of what it takes to create the game. However, it's not really easy to say "just do this". What I ended up with wasn't so much a game as a board analyzer. It could look at the board and figure out the top 40 moves it could make using the tiles it was given.
I think your best bet is to look for examples online. I found some, but unfortunatlly I don't have the links anymore. I don't think I ever found an example in vb.net. The closest I could find was C#.
Is this game supposed to be Human vs. Human, Human vs. Computer, or both? This will definitly change what you'll need to code. The first thing you'll need is a dictionary. Even if it's human vs human your going to have to verify words. The site I got my dictionary from doesn't seem to have it anymore. However, I've still got the text file with all the acceptable words for tournaments. I think the list is from 2005. A little old but probably good enough. If you need it I'll get it to you.
Other than that I don't know what else to say. I think classes will be your friend. Try to break the game up into logical parts. For instance I had a tile class that represented individual tiles, a bag class which held the tiles, and a board class which represented the board. I think I even had a rack class to hold the tiles for the players. Definitly make good use of classes. If have specific questions feel free to ask. Hopefully I can help or someone else on here knows something or could point you to helpfull sites. Unfortunatly all my links from my research are gone.
|
|
|
|
|
By tile are you refering to wheather or not its a double, triple word etc. If you look at it on a row by row basis it makes things easier. Using Select case statments within a loop will be the easiest. Also try to figure out where you can take shortcuts. For instance a double word appears in a step pattern. In row 1 it appears in the first and last column. In row 2 it appears in the 2nd and second to last column. So, to determine where the double should be for a particular row you could use (Row,Row) and (Row,16-Row) where the first value is your row and the second value is your column. Using a select case statment you can easily exclude the few rows that don't have double words. To try to clarify my point I'll show you a snippet of code I used. I hope the concept will be clear.
'//Loop through each row
For i As Integer = 1 To 15
'
Select Case i
Case 1 To 5, 8, 11 To 15
'//Place doubles
.Item(i, i).Style.BackColor = dw
.Item(i, 16 - i).Style.BackColor = dw
End Select
Next
I would use a single select case statement for each different type. Of course you could do the same thing with If..then statments but I find in this case using Select...Case is easier and cleaner. Additionally I think I would seperate your board initialization code from your tile placement code. Use the two loops you already have in your button click event to place the controls on the form. I would set each square initially to blank that way you don't have to worry about blanks. Then after that code executes use a single loop that iterates through each row and add all the appropriate select case statments to set each square.
An additional note. I think you have reversed the placement of your rows and columns.
Change this line:
mysquare = New Square(irow * 40, jcolumn * 40)
To:
mysquare = New Square(jcolumn * 40, irow * 40)
|
|
|
|
|
Thank you my scrabble board is working. but second step is that i have to create a tray with Letter ( a,b,c.....Z). and everytime user enter word in textbox and specify the location ( such as row 2 column 3) and click move. whatever user enter in the box has to moved to the scrabble board. can you please help me how should i define my Tiles equal to string letter a. such as i have tiles from A to z. Tile001.jpg is A , Tile002.jpg is B and so on. i dont know how should i declare in my class..... thanks
|
|
|
|
|
I would create a Tile class. It would probably make sense to inherit from picturebox again. A tile has two important properties
1) It's value
2) It's letter
The class could take the letter and value in the constructor. The image to use could be determined by the letter passed. A captitol 'A' has a ascii value of 65 and corrisponds to Tile001.jpg. So to figure out which image to use you could get the ascii value of the letter passed, for example ASC(letter) and subtract 64. You can then construct a string that matches the appropriate image name and set the image for the picturebox.
To place it on the board you could iterate through your 'Tiles' in the rack and test if the letter is the letter needed. If it is you could move it onto the board by adding the Tile object to the control collection of the appropriate square.
|
|
|
|
|
can you plz give me some lines of code. cuz i could not figure out.
|
|
|
|
|
I'm not sure what lines of code you need, nor do I want to write this for you. I'm positive you can write the class I had in mind. It's very simple and almost the same thing as your square class. All it has are two properties: value, letter. I already said how you could figure out which image to use, but maybe this will help clarify.
Dim letter As String = "A"
Dim pos As Integer = Asc(letter) - 64
Dim file As String = "Image" & pos.ToString("000") & ".jpg"
As for implementing this class into your program there isn't much I can write to help you out. You know the code better then I do. This may help though. Controls can contain other controls. Pictureboxes are no exception. You can use square(1,1).controls.add to add another control to the square. So if you create a tile object and use 'add' you can put the tile inside the square tile. Just be sure to set the location of the tile object to (0,0) when you do.
|
|
|
|
|
line of code i asked you. cuz i am getting my 7 tiles rendomaly. only the first 7 tiles. cuz i am not sure how i should declare my "Tile01" is equal to letter string A. and so on. i dont want to write 26 lines of code. thats the only part i am missing.
|
|
|
|
|
I'm not sure I'm following, sorry. Can you try to describe in detail what the problem is. From what I got before the user types in a word they want to place. Lets say they type in 'Cat'. You need to pick tiles from your tray that represents a 'C', 'A', 'T'. If your tile object has a letter property you should be able to loop through your tiles and compare it with the letter you need. Once it matches you know you have your tile to place on the board. There isn't any need for 26 comparisons. You don't care what letter it is you just care that the letter needed matches the letter value of the tile.
If your trying to figure out how you know which image to use for which letter then I already gave you that code in the last post. If you don't understand the code I'll try to explain it, but at this point I'm not sure if that's the problem. As I said I'm not getting exactly what the problem is at this point. If I haven't helped please try to be as clear and detailed as possible so I understand what's going on and whats required.
|
|
|
|
|
thanks my game is working somehow... thanks for the help
|
|
|
|
|
Hello,
I Just wanted to let you know if any of you (c#\.net programmer) are looking to show off your skills or get involved in a project you might want to consider clamav. ClamAV is the leading openSource Antivirus, and right now they are looking for programmers to help with version 1.0 which would include an on acess scanner and possibly other features.
If you are intersted please post in the following post :
http://forums.clamwin.com/viewtopic.php?t=905
Thanks
Al968
Avast Antivirus-<url>http://www.avast.com<url>
|
|
|
|
|
Yes we need such antivirus (mine was not able to detect your spamming)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
What is it about Point #10[^] that you don't get?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello,
I need help converting the following code to VB.NET:
Open folder_file For Input As #1
Do While Not EOF(1)
Line Input #1, line_1
new_folder = full_folder & "\" & line_1
If Dir(new_folder, vbDirectory) = "" Then
MkDir new_folder
End If
Loop
Close #1
Thank you!
|
|
|
|
|
You'll want to use a streamreader object to read the file. You should be able to find examples online.
|
|
|
|
|
I have a For Next loop that places 9 Labels on to the form and gives each one a Tag=0.
When you click one of the labels it's text is changed to an X and it's Tag is changed to 1.
Or one of the labels text is changed to a O and it's Tag is changed to 10.
What I want help with is, how to check each label to find out if 3 of the labels have a tag of 1 or 10 in a row and if they do 'Winner'.
|
|
|
|
|
|
Thanks for the link will download the source and read it through it.
|
|
|
|
|
I am very new for VB.net (Visual Studio 2005) and also very new for SQL Server 2005 Express
I do have a Trial1.mdf install in Server Local c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Trial1.mdf
I tried to connect/open/close as the following codes:
<br />
Imports System.Data.SqlClient<br />
<br />
Public Class Form1<br />
<br />
Dim sqlConnection As New SqlConnection("server=localhost;uid=NULL;pwd=NULL;database= c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Trial1.mdf")<br />
<br />
sqlConnection.Open()<br />
sqlConnection.Close() <br />
End Class<br />
But it fail to run (even re-build no-error), can someone tell me what should I do to use my Trial1.mdf correctly?
Thanks for any help
|
|
|
|
|
Hi
For connecting to database, you need to provide UID, password and database. The .MDF file can be attached to the SQL Server.
For attaching the database, Check this link
Attaching Database[^]
After attaching, your database name will be the datasource in your connection string.
Hope this helps.
Harini
|
|
|
|
|
I did try as you said and it improves my issue, however I still can not open and use my trial1.mdf. Here my update codes:
<br />
Imports System.Data.SqlClient<br />
<br />
Public Class Form1<br />
'Link database<br />
Dim DB_Location = "c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Trial1.mdf"<br />
Dim MyConnection = "Server=localhost; DataBase= " & DB_Location & "Integrated Security=SSPI"<br />
Dim sqlConnection As New SqlConnection(MyConnection)<br />
<br />
'Use database<br />
Dim strSQL As String = "SELECT FROM Trial1 WHERE col2 = 'trial' "<br />
Dim cmd As New SqlCommand(strSQL, MyConnection)<br />
<br />
sqlConnection.Open() ' ----> error<br />
cmd.ExecuteNonQuery() ' ----> error<br />
sqlConnection.Close() ' ----> error<br />
<br />
End Class<br />
At the last 3 line of codes I got the errors ... can you help me to correct it?
Thanks
|
|
|
|