|
Hi,
I have a list of records. Those records have a field called Progress. There are 4 Progresses. 'Pending', 'Work In Progress' and 'Completed'.
If I sort by Progress in ASCENDING, then the order will be:
Completed
Pending
Work In Progress
If I sort by Progress in DESCENDING, then the order will be:
Work In Progress
Pending
Completed
I need PENDING to be at the top. So that all the records which are PENDING will be at the top and the rest can be sorted as normal. Any ideas how I can do this?
Thank you.
|
|
|
|
|
Add a new column to the DataTable in memory and set the value based off the Progress column. That way you can set Pending = 1, work in progress = 2, completed = 3. Then in your code take the dataview and sort it.
dim dv as DataView = dataTable.DefaultView
dv.Sort = "NewSortColumn"
Or you could just add a Sort column to your table in the database as well.
Or you could move the Process column into its own table and just stored the processid in your table you are returning.
Hope that helps.
Ben
|
|
|
|
|
Or sort based on len(Progress) bcos it has the least length.
Regards,
Arun Kumar.A
|
|
|
|
|
That's a really bad idea. I'd fire you if you wrote code like that.
What if the status enums change? How about localization changes in the text of the enums??
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Sorry , I didn't think on these effects.
Anyway, thank U very much.
Regards,
Arun Kumar.A
|
|
|
|
|
Silly me .. I found the easiest and most reliable way of doing this..
Simply add another column in the Database called Progress Number. Pending will be 1, Work In Progress will be 2.. etc..
And then simply sort by "ProgressNumber"
Thank you guys for the help.
|
|
|
|
|
Hi,
I have a windows form and I want to print the contents of it. Is it possible to do this in vb.net
|
|
|
|
|
It is.
There is an article here[^] that gives one way to do it, and there is also an MS control that emulates the old VB6 "PrintForm" command in the Visual basic Power packs...
|
|
|
|
|
Hi,
Will this work with VB.net 2003. also I can't find the component. Can you help.
Thanks
|
|
|
|
|
It doesn't work with VB.Net 2003 because the code is written with VS 2005 and uses some of the newer language features such as generic collections.
You could just use the compiled component if you have someone who has VS2005 to compile it up for you or move your code to VS2005?
(The component is in the source code attached to the article)
|
|
|
|
|
|
Hi all,
I have written code in VB(Using MSCOMM Control) to Dial a phone Number through internal modem.The code is working fine i am able to make a phone call through Modem. But the problem is How to record a Phone Call. Can any one Help me to Record a phone Call
Thanks & Regards
S.Raju
|
|
|
|
|
Making the call was the easy part
Recording the call is going to be harder. It depends on how you made the call really as to how you can get attached to the audio stream and if your modem even allows you to get it.
Personally I like to keep modems for data communication and not voice. They were not really made for voice.
Tapi is going to be a pain as it really does not work very well with managed code (no matter what anyone says) and the Unimodem TSP does not support full duplex audio.
|
|
|
|
|
Hi all,
Thank You.
Can u tell me the procedure to record a phone Call.
Thanks & Regards
S.Raju
|
|
|
|
|
As I said there is no really simple way to do it using Tapi and managed code but I am not even sure about what interface you are using?
What kind of modem do you have? Is it a modem that has speaker phone functionality or just a plain modem?
Personally I always point folks trying to do voice applications with modems to stop before they put to much work in and make the step to real telephony hardware that is built to do this stuff.
Let me know if you are ready for that. Its not cheap but I can help out a bit with the programming aspect.
|
|
|
|
|
Hi all,
Thank u for giving Reply to My Question. I am using smart link 56k internal voice modem,this modem is not having speaker phone functionality. I have written code in VB 6.0 using MSCOMM control. By using properties of this control i am dialing a phone number through MODEM,it is working fine.Now i want to record this call, could u please tell me how i can Record the Phone call.
Thanks & Regards
S.Raju.
|
|
|
|
|
Oh,
You cant do this using MSCOMM. That control only lets you talk to the modem and use it for data communications. It doe snot provide you with an Audio stream as you think it does. It interfaces to a com port and allows you to send/receive data. The underlying audio stream is still managed by the hardware itself.
To get to the voice path in any way you are going to need to talk to the hardware at a lower level. I suggest that you start digging into Tapi a bit. There are some great resources out there to help people get started there. Just do a Google search for 'Tapi FAQ' and start reading.
Be aware that Tapi is not for the faint of heart nor does it interface really well with VB. It makes use of callbacks and some very touchy data structures that can cause a VBer much pains. It may be better for you to start looking for an ActiveX control that abstracts all the junk into something a bit more COM based.
Either way you are going to have to start dealing with media streams to get the audio data you want, and once again, if you are trying to use this modem to make a call on your behalf and want to record the entire conversation (what you are speaking and what the other person is speaking, you are going to run into some issues because the Unimodem TSP is not full-duplex. Remember the fact that these modems do voice at all is really an afterthought. They were first and foremost data communications devices. Companies trying to shoehorn speakerphones and answering machines into them was just to build some added value for consumers, not to provide a feature rich application development environment for software devs to write applications on. If you are writing for anything other than personal use, trust me, don't bother using a modem.
|
|
|
|
|
any one can help for that:-
actually i want to select any line from 1st text file and want to paste for it in to the second text file.
|
|
|
|
|
You can't. You can read any line you want, then you need to read the second text file, insert the line, then write the entire file. You can't just insert a line into a file.
VB2005 has My.FileSystem to do this stuff with. But, it makes more sense to use System.IO.File.ReadAllText and WriteAllText directly, so you know where it is if you ever need to use C#.
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 )
|
|
|
|
|
actually my problem is diffent.
Actually i want read a line from 1st text file and search this line in the second text file( which had the string as in 1st txt file and equivalent localized string) and then copy this localized string from 2nd text file and replace with the 1st one.
Thanks in advance!
pankaj kumar
|
|
|
|
|
Your problem is the same. You still can't replace text in a file, you still need to read all of the file in, change it in memory and save it all out again.
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 )
|
|
|
|
|
I have a need of importing the .DAT files into the application.
The first row in the file is considered as header and rest for data, The data is seperated by TABDelimiter.
Any suggestions plz....
Help....
Jats
|
|
|
|
|
There are a plethora of articles on this site for dealing with CSV files. Take one and replace the comma with a tab.
|
|
|
|
|
I had tried that before, but its not working.
As the file type is .DAT, there is some problem with the connection string b'cause when i opened the connection and tried to assaign the data to a datagridview its throwing an error stating "ERROR [42000] [Microsoft][ODBC Text Driver] Cannot update. Database or object is read-only."
The code is as follows....
Private Sub ConnectDAT()
ds = New DataSet()
Dim sql_select As String
Dim strConn As String = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + TextBox1.Text.Trim() + ";Extensions=asc,csv,tab,txt;Persist Security Info=False"
' The connection string is given as "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=D:\Folder;Extensions=asc,csv,tab,txt;Persist Security Info=False"
Dim conn As OdbcConnection
conn = New System.Data.Odbc.OdbcConnection(strConn.Trim)
conn.Open()
sql_select = "select * from [" + strCSVFile + "]"
obj_oledb_da1 = New System.Data.Odbc.OdbcDataAdapter(sql_select, conn)
obj_oledb_da1.Fill(ds, "CInfo")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "CInfo"
conn.Close()
End Sub
Can you help me...in solving the problem...
Jats
|
|
|
|
|
Jats_4ru wrote: As the file type is .DAT
The file extension has nothing to do with it. It is the contents for the file that are important. You have described a tab separated file.
Jats_4ru wrote: there is some problem with the connection string b'cause when i opened the connection and tried to assaign the data to a datagridview its throwing an error stating "ERROR [42000] [Microsoft][ODBC Text Driver] Cannot update. Database or object is read-only."
Why are you using an ODBC connection at all? There are hundred of examples of a CSV reader, quite a few here on CodeProject, that work perfectly well without resorting to inefficient kludges like ODBC. Look for those projects and change the comma to a tab (like I already suggested)
|
|
|
|