|
I have written a routine to manipulate a large bitmap (actually it is a raster image of a map).
After loading the bitmap into memory I have used DrawImage() to zoom in and out and scroll the map in a picturebox.
However, the quality of the same bitmap in the picturebox is OK, but no where nere as good as the image displayed in the windows Picture and Fax viewer. Can anyone explain why? Does the windows viewer use GDI+ or perhaps DirectX. Is there a way of tweaking drawimage to get better results.
thanks in anticipation.
regards,
MP
|
|
|
|
|
Please note that I am a beginner VB.net programmer. Any help you can offer would be appreciated.
I am trying to sort a datatable loaded from an SQL db table. There are 2 sort keys, both ascending, and 9 other columns. The primary key, "PurchaseOrderID", can contain nulls, although it is usually a string of format "999999_999". After loading the ds, I use the following code to try to sort the records:
Dim myDataView As DataView
myDataView = ds.Tables("tPIA").DefaultView
myDataView.Sort = ("PurchaseOrderID, TimeNeeded")
The problem is I need the rows with null values in PurchaseOrderID to all sort to the high end. I know one can write a custom comparer to modify sort order but I haven't seen the syntax of how one can use a comparer with a dataview.
Can this be done? If so, what's the syntax?
If not, do you have any other suggestions? I originally loaded the SQL table into a Collection but there didn't seem to be a sort method available there. So I loaded the Collection into an array and wrote a custom comparer, but then I couldn't seem to sort on the 2 fields, as required.
Thank you,
mif
mif
|
|
|
|
|
Try this
MyDataView.Sort = "PurchaseOrderID, TimeNeeded ASC"
-or-
MyDataView.Sort = "PurchaseOrderID ASC, TimeNeeded ASC"
Use DESC for Descending
*EDIT*
I just tried it with a dataview containing null values and it sorts the null values to the top of list in my datagrid. I really don't see a problem with your code. I thought maybe the parentheses in your .sort code was the problem but it works either way.
|
|
|
|
|
Thank you for the help - however I am not getting the results expected. Although ASC is the deafult, I did add ASC to both sort keys:
myDataView.Sort = ("PurchaseOrderID ASC, TimeNeeded ASC")
Here is a sample of the output, where PurchaseOrderID is column(2) and TimeNeeded is column(9) on a 0 to 11 basis:
Row: 119
34028_1_1, 7/25/2005 12:00:00 AM, {unspecified}, , 12345-0003, 1, xxx, 0, , 7/25/2005 12:00:00 AM, M,
------------------------
Row: 120
33734_1_1, 9/11/2005 12:00:00 AM, {unspecified}, , 12346-0002, 1, xxx, 0, , 9/11/2005 12:00:00 AM, M,
------------------------
Row: 121
33597_1_1, 12/12/2012 12:00:00 AM, {unspecified}, , 12345-0001, 1, xxx, 0, , 12/12/2012 12:00:00 AM, M,
------------------------
Row: 122
33596_1_1, 12/12/2012 12:00:00 AM, {unspecified}, , 12345-0001, 1, xxx, 0, , 12/12/2012 12:00:00 AM, M,
------------------------
Row: 123
33596_1_2, 12/12/2012 12:00:00 AM, {unspecified}, , 12345-0001, 2, xxx, 0, , 12/12/2012 12:00:00 AM, M,
------------------------
Row: 124
33597_1_2, 12/12/2012 12:00:00 AM, {unspecified}, , 12344-0001, 2, xxx, 0, , 12/12/2012 12:00:00 AM, M,
------------------------
Row: 125
32798_1_1, 12/31/2029 12:00:00 AM, {unspecified}, , 1234-0003, 2, xxx, 0, , 12/31/2029 12:00:00 AM, M,
------------------------
Row: 126
32412_1_5, 12/31/2029 12:00:00 AM, {unspecified}, , 12345-0002, 3, xxx, 0, , 12/31/2029 12:00:00 AM, M,
------------------------
Row: 127
118121-000, 1/28/2005 12:00:00 AM, {unspecified}, 25, 12345-005, 9, xxx, 0, , 1/28/2005 12:00:00 AM, M,
------------------------
Row: 128
117604-101, 1/13/2005 12:00:00 AM, 147347_020, 540, 12345-1234-006, 1, {unspecified}, 0, 12/22/04, 1/18/2005 12:00:00 AM, P,
------------------------
Row: 129
117749-101, 2/3/2005 12:00:00 AM, 147347_021, 540, 12345-1234-006, 1, {unspecified}, 0, 12/22/04, 2/8/2005 12:00:00 AM, P,
------------------------
Row: 130
117941-101, 3/9/2005 12:00:00 AM, 150236_005, 105, 12345-001, 10500, {unspecified}, 0, 03/07/05, 1/19/2005 12:00:00 AM, M,
------------------------
Row: 131
118122-000, 1/26/2005 12:00:00 AM, {unspecified}, 20, 12345-004, 12, xxxx, 0, , 1/26/2005 12:00:00 AM, M,
------------------------
Row: 132
118110-000, 12/20/2004 12:00:00 AM, {unspecified}, 20, 12345-003, 5, xxxx, 0, , 12/9/2004 12:00:00 AM, M,
------------------------
Take a look at rows 126 and 127 - although PurchaseOrderID has been {unspecified} through this point, TimeNeeded has jumped backwards from 12/31/2029 to 1/28/2005. The watch has these colums delimited by "#"s so I have reason to believe that .net is indeed seeing the fields as dates and not strings.
Can you offer any other suggestions?
Thanks!
m
|
|
|
|
|
mfriedenthal wrote:
The watch has these colums delimited by "#"s so I have reason to believe that .net is indeed seeing the fields as dates and not strings.
Are you sure the data isn't being handled as a string? I made a quick table in ms access and it sorted it fine with the "TimeNeeded" column as a DATE/TIME but when i changed it to a string it basically returned results like you show. Double check the column data type:
Debug.WriteLine(MyDataSet.Tables("MyTable").Columns("TimeNeeded").DataType.ToString)
Do the same for your PurchaseOrderID column. Other than being the wrong datatype I can't understand why it doesn't work for you.
|
|
|
|
|
Thanks for the advice, but I did as you suggested and I got back:
System.DateTime
System.String
for TimeNeeded and PurchaseOrderID, respectively. Which is what I expected.
Still researching...
Any help would be appreciated.
Thanks!
|
|
|
|
|
I want to check wether the file is being used by some other application or software i want to do some task if that file is being used by some other application.
for ex. if a slideshow player is opening some jpg files and playing slide show
there is a file names kkk.jpg in sequence of the slideshow i want to check weather the file is accessed or not i will check before the slideshow begins
We are presenting a slideshow of our teachers at one photograph we want to play a specified music i want to use vb for this..
I will be thankful if any body helps me.....
|
|
|
|
|
Uhhh, why? PowerPoint can already play the music when a specific slide is shown. All you have to do is tell it which file to play...
Without writing a specific file system extension, you can't reliably monitor the file to see if it was opened by some other process. In order to get this to PARTIALLY work, you would have to constantly try and open the file exclusively, denying any shared access, just to see if the file was opened by some other process. If the file opens, no other process has it open. If it doesn't open, something else has it open. But, there are multiple problems with doing this:
1) You must try to open file, repeatedly, fast enough so that you don't miss the file being opened, read, and closed, in between your attempts to open the file. This will have the effect of degrading system performance and slowing down all other applications.
2) As explained in 1, you could easily miss a file being open, then closed.
3) If your monitor manages to open the file, you will automatically prevent any other app from opening that file. This will cause your presentation to stop or possibly crash altogether.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to make Display Blank Screen for a Specified Period in VB is there any function.
|
|
|
|
|
Why would you want to do this, considering your app has to play nice with others on a SHARED system?
If I was using your app and it blanked the entire screen, preventing me from using my other apps, I'd click close on your app then, promptly, uninstall it...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i want to do some background process which should not display
kindly help me
|
|
|
|
|
Ramesh Yadavalli wrote:
i want to do some background process which should not display
There are all kind of thing you can do with a background process without anyone seeing it. But making the whole screen black sound like you're trying to make a prank or get fired from your job!
But it's really easy
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Me.BackColor = Color.Black<br />
Me.FormBorderStyle = FormBorderStyle.None<br />
Me.WindowState = FormWindowState.Maximized<br />
End Sub<br />
|
|
|
|
|
Your background process doesn't have to have a form. Just write up a class that does what you want and launch it from whereever you need to as a seperate Thread. Just make sure you tag that thread Background = True .
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I download a program located at ftp://ftp.softcircuits.com/vbsrc/browse.zip and being a newbie, i failed to make the code work. i mean to make my code work with the program... the code is given below:
Private Sub Command1_Click()
Dim myfile
Dim i As Integer
For i = 1 To 999
myfile = Dir("C:\" & i & ".bmp")
If Not myfile = i & ".bmp" Then
fSaveGuiToFile ("C:\" & i & ".bmp")
Exit For
End If
Next i
End Sub
I would like the user to choose the path like the one at ftp://ftp.softcircuits.com/vbsrc/browse.zip but failed to integrate this code of mine to work with it. I dont want the file to be saved at C:\ but to the location the user specifies... could you please help me out. thanx
|
|
|
|
|
What are you trying to do here? That is the weirdest piece of code i think i've ever seen.
What does
mex_young wrote:
fSaveGuiToFile
do?
I am happy to help as i think it quite a simple solution, but can you explain the problem a little better.
If you could please explain what you need to do?
Thanks
"If i was king cigarettes would be free."
|
|
|
|
|
I actually want the code of mine which was pasted there to work with the program where u may download in zip format.
The code of MINE which is pasted is actually a part of my script which saves a .bmp file to C:\ automatically when it is pressed! and changes the file name to something like - 001.bmp, 001.bmp... etc! and goes on as the button is pressed. i hope you understand...thanx
|
|
|
|
|
I have created a Event in a form and raised it in another class within the same project.
The "RaiseEvent" was executed in the class, but the event was not trigger in the form.
Anybody have any ideas???
|
|
|
|
|
I'd check first to see if the EVENT on the form has a handler. Sometimes if you delete or cut/paste a control you'll loose the handler for the event but the event stays and you're left scratching your head.
Sub MyEvent(byval sender as object, byval e as system.event) handles MyClass.MyEvent
-or-
addHandler MyClass.MyEvent, addressOf MyEvent '<--Handler won't get deleted if you cut/paste
Other thing that happens to me is some other event raises an exception and causes the RaiseEvent to fail. Especially if i have a Try Catch with an empty catch that i havent coded in a response yet(not a good practice)
|
|
|
|
|
How can I create FTP client that can automatically download files from server at specified interval and place it on a specified location on local system.
|
|
|
|
|
Hello guys
any one can help me to write a script which will rename Neoware thin clients
hostnames?
I'll appreciate it!!!
Thanks in advance
|
|
|
|
|
This can't be done in any of the scripting languages, like VBScript. It must be done using a full application laungage and this app MUST be run by an Administrator of the machine in order for it to work.
The API Function that you're looking for to do this is SetComputerName[^]. Once the change is made, the machine MUST be rebooted for the change to take effect.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave
The OS is WinCE.
Can you give me a simple steps on how to write a simple application to rename hostnames?
and what language? Can I use C#?
Appreciate your time!!!
|
|
|
|
|
The language you use is up to you. There's nothing special about an app like this. All you need to do is get a string, however you choose, that represents the hostname you want to change the machine anme to, then make a call to SetComputerName. That's it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello everybody. I am trying to create a string which will have spaces in between words that create "columns". In vb6 i used to use tab(<and the="" number="" of="" column="">). EG string 3 = string1 & tab(5) & string2 and i would have the following:
areaName PostCode Suburb
test 125 the suburb
test2 225 another suburb
so when i use the print command to have it in columns.
How to i do that in vb.net. Thank you in advance.
Still trying to find the way
|
|
|
|
|
I just had that same problem. Here is an example:
<br />
' Draw all font names on form<br />
Dim gr As Graphics = Me.CreateGraphics<br />
gr.Clear(Color.White)<br />
<br />
' Prepare a message with tabs and carriage returns.<br />
Dim msg As String = String.Format("{0}Column 1{0}Column 2{0}Column 3{1}" _<br />
& "Row 1{0}Cell (1,1){0}Cell (1,2){0}Cell (1,3){1}" _<br />
& "Row 2{0}Cell (2,1){0}Cell (2,2){0}Cell (2,3){1}", _<br />
ControlChars.Tab, ControlChars.CrLf)<br />
Dim fnt As New Font("Arial", 12)<br />
<br />
Dim strFormat As New StringFormat()<br />
' Set the tab stops.<br />
Dim tabStops() As Single = {80, 140, 200}<br />
strFormat.SetTabStops(0, tabStops)<br />
' Draw the text with specified tab stops.<br />
gr.DrawString(msg, fnt, Brushes.Black, 20, 20, strFormat)<br />
<br />
fnt.Dispose()<br />
gr.Dispose()<br />
<br />
Hope that hels you!
|
|
|
|
|