|
Hey r u preparing for the Interview?
Please get the Books for .NET there are lot of book savailable in the Market.
Some of the Publications are Wrox, Apress etc.,
Pls hereafterwards don't put the questions like this here?
If we want to explain abt the five topic you have asked it refers to the whole book.
So please be specific in your doubt and ask it here in forum.
Regards,
Satips.
|
|
|
|
|
gday,
i realise its VB 101 again, but was hoping someone could direct me to where I could find out how to use the datepicker . The circumstance is that on my form I have two date pickers and I want to be able to calculate how many nights between the two dates chosen
|
|
|
|
|
The date picker is not the issue. Each date picker will return a DateTime. Subtracting one date time from another results in a TimeSpan, which will give you the value you need.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Im not sure exactly what the problem is, but when i fill my dataset using a background worker, the data never shows in my grid...this is not an issue when not using a background worker...any sugestions?
below is the only code in the background worker:
DsCustomersGrid1.Clear()<br />
DsCustomersGrid1.Merge((New DSCustomersGridTableAdapters.SelectAllCustomersForGridTableAdapter).GetData(ZipsCommon.SetupInfo.StoreID, True))
Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so
|
|
|
|
|
This is because you can't update a control (even it's data) from a seperate thread. You have to Invoke a method on the UI thread to update the control for you.
Create a method on your form that takes the data as a parameter and adds the data to the control. Invoke this method from your background thread and it'll marshal the call to the UI thread to do the work.
|
|
|
|
|
Doesn't this defeat the purpose of a background worker? Invoke would cause the method to run back on the main thread, which would bog down the thread since they have over 50,000 customers that are being loaded into the dataset...Is there a way to do this on a separate thread? I guess I could run it on the background worker and then send each individual row to the main thread one at a time with invoke, that would keep it from bogging down, but it would take so long to load that they would end up having to wait for the grid to load before they could really do anything anyways...any suggestions?
Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so
|
|
|
|
|
You can load the dataset entirely in the background thread, then Invoke the binding through the UI thread. Personally, I find havin 50,000 records in a DataSet a waste of time if all you're going to do is show a small block of records out of that set or doing some processing on only a small block of that data.
A paging solution would be in order for this...
|
|
|
|
|
I agree with that 100%, unfortunately my boss wants it to show all of the records, with a scroll bar down the right side...I'll try loading the dataset on the background worker and then passing it back through the e.result and merging on the worker complete event. Thanks for the help
Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so
|
|
|
|
|
I am thinking about writing a program for the PPC platform that will populate 4 combo boxes from columns in an excel spreadsheet, and then display a few fields based upon a selection from one of the combo boxes. Does anyone have any good code examples for this?
David Wilkes
|
|
|
|
|
Hi im writing a little media player app and as i wanted to learn some basic DirectX stuff,i used DirectX, i have managed to get the mp3's to play, but when running it using 100% of the cpu the mp3 plays in a new thread but just havent got a clue why its using 100% cpu any help would be great thanks
Danny
P.S im using vb.net 2005 if that helps
|
|
|
|
|
Really, there's no way to answer this question because we know nothing about how you've written your code, or even what it's doing when the CPU goes to 100%.
|
|
|
|
|
Hi sorry about that, what im trying to do is play an mp3 in a new thead without using 100% of the cpu what i was trying to find out was if this was normal using dirext audio video or just me being a muppet im going to guess the latter of the two, anyway no worries i really cant be bothered to solve this now and will just work it out another time
thanks for taking time to reply
|
|
|
|
|
SQL Command:
-------------------------------------------------
USE MyDB
SELECT SUBSTRING(HEXTEXT, 1, 100) AS HEXTEXT
FROM MyTable
WHERE MyID=200
-------------------------------------------------
In SQL 2005, this returns:
-------------------------------------------------
0x680065006C006C006F002100
the Hex representation of 'hello!'
-------------------------------------------------
I try to get it back into my VB.NET app using:
------------------------------------------------------------------------------------------------
ConnectionString = "Provider=" + Provider + "Driver=" + Driver + "Server=" + Server + "; Database=" + DB + "; UID=" + Username + "; PWD=" + Password + ";Trusted_Connection=yes;"
Dim queryString As String = "SELECT SUBSTRING(HEXTEXT, 1, 100) AS HEXTEXT FROM MyTable WHERE MyID=200"
Try
Using connection As New OdbcConnection(ConnectionString)
Dim command As New OdbcCommand(queryString, connection)
connection.Open()
Dim reader As OdbcDataReader = command.ExecuteReader()
While reader.Read()
MsgBox(reader(0).ToString)
End While
connection.Close()
reader.Close()
End Using
Catch ex As Exception
MsgBox("Something database related screwed up.")
Exit Sub
End Try
-------------------------------------------------
When I run this i do not get any errors, i get 'System.Byte[]' in my message box? What gives?
|
|
|
|
|
You get that because you called the ToString method on an Array. This will NOT automatically convert the numbers in the array to characters or to a string of numbers.
What's the output you're looking for? Provide an example of what you want it to look like.
|
|
|
|
|
I would be more than happy with my datareader returning the hex characters to me. If possible, converting it to the ascii would be even better, but hex would be a great place to start!
|
|
|
|
|
svanwass wrote: I would be more than happy with my datareader returning the hex characters to me.
It looks like you stored a string in the database, that looks like "0x680065006C006C006F002100". So, you're looking to convert this string of characters into an array of numbers?? Like "0x6800" would become an integer 6800h, and so on down the line?
|
|
|
|
|
The information was stored as data type 'image'. 0x680065006C006C006F002100=hello! in ascii. Does that make more sense?
|
|
|
|
|
That would explain why it's being returned as an array of bytes.
Ascii is a set of characters numbered 0 thru 128. An extended set goes to 255. What you have in this array is UniCode. Every other byte is 0x00, giving it away. What the Reader returned was equivilent to:
Dim bytes() As Byte = {&H68, &H00, &H65, &H00, &H6C, &H00, &H6C, &H00, &H6F, &H00, &H21, &H00}
You can convert this array of bytes to a string using:
Imports System.Text
.
.
.
Dim str As String = Encoding.Unicode.GetString(bytes)
|
|
|
|
|
Rock out! I changed it up to
Dim str As String = Encoding.Unicode.GetString(reader(0))
and it works!
On a side note, I DID scour the MSDN articles, CodeProject, and Google but never found what i was looking for. This is more than likely because i am not sure what topic i would need. Knowing where i fell down, any suggestions on topics to read up on?
THANKS A MILLION!
|
|
|
|
|
Well, that's the hardest part about learning the .NET Framework. It's massive collection of thousands of classes, containing tens-of-thousands of methods and properties. It involves LOTS of reading and experimentation.
About 6 years ago, when I got my hands on the Beta for .NET 1.0, I started by reading whatever documentation I could find in the MSDN Library, evaluating which namespaces were going to help me the fastest and built from there.
Today, I probably suggest picking up a beginners book on VB.NET and start reading through the clas documentation in the following namespaces:
System.Collections
System.Data (stick to OleDb for now)
System.IO (just the root, not the child namespaces under it!)
System.Text
System.Windows.Forms (just the root, not the child namespaces under it!)
Then start adding other stuff like System.Xml and System.Runtime.Serialization.
|
|
|
|
|
I seem to have run into a second problem that seems to be related. For my sample data, I have
"
hello!
GOODBYE!
hello!
GOODBYE!
BONJOUR!
HALLO!
NOWAY!
"
in the cell that i am pulling from with your code. When i run it, i only get this much:
"
hello!<cr><lf>
GOODBYE!<cr><lf>
hello!<cr><lf>
GOODBYE!<cr><lf>
BONJOUR!<cr><lf>
HALL
"
As you can see, there is some missing text (O!<cr><lf>NOWAY!).
Could this be related to Encoding.Unicode.GetString(reader(0))?
I am storing the result in a string so I do not think that it is getting chopped on that end.
The While reader.Read() does not execute a second time (my first thought was that there was a limit to how much it could take).
If you have the time or the patience, your help would be greatly appreciated.
-Steve
|
|
|
|
|
It's possible. Two 0x00 characters in a row would normally denote the end of a string.
Why are you using a binary data type for storing string data?
I really can't tell you what's wrong. There's a bunch of different places this can fail, such as what the code looks like that stored the data, if the data get stored properly, if the encoding is consistent throughout the data, ...
|
|
|
|
|
I found a fix for it. I changed from using System.Data.ODBC to System.Data.SQLClient. That does not limit me at all.
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
myConnection = New SqlConnection("server=" + Server + ";uid=" + Username + ";pwd=" + Password + ";database=" + DB + ";Trusted_Connection=yes;")
'establishing connection. you need to provide password for sql server
Try
myConnection.Open()
'opening the connection
myCommand = New SqlCommand("SELECT *FROM MYTABLE WHERE MYID='" + MYTHING.ToString + "'", myConnection)
Dim dr As SqlDataReader = myCommand.ExecuteReader()
While dr.Read()
'mystr = dr.GetString(0)
'reading from the datareader
MsgBox(Encoding.Unicode.GetCharCount(dr(0)))
mystr = Encoding.Unicode.GetString(dr(0))
MsgBox(mystr)
'displaying data from the table
End While
dr.Close()
myConnection.Close()
Catch
End Try
|
|
|
|
|
Does anyone know how to do the following:
If listbox2 contains recycle.wav do not add recycle.wav to listbox1.
|
|
|
|
|
Why not just enumerate the items in the ListBox, comparing the one your searching for to the items in the list?? If you find it, don't add it to ListBox2.
|
|
|
|