|
what's the source code for shutting my pc using the vb?
or opening my dvdr?
thankz,
|
|
|
|
|
shdtwen wrote: what's the source code for shutting my pc using the vb?
Whatever the code is that you come up with. But, in the end it's going to involve calling ExitWindowsEx[^].
If you want examples of it's use, all you have to do is Google for "vb.net ExitWindowsEx[^]".
|
|
|
|
|
or you could use the ms-dos's shutdown command
shutdown -s -f
where:
-s shutdown computer completly
-f force to close applications
|
|
|
|
|
Shutdown doesn't come with all flavors of Windows.
|
|
|
|
|
Dave Kreskowiak wrote: Shutdown doesn't come with all flavors of Windows.
I was going to say that. It has odd variations in Linux depending on what distribution...
|
|
|
|
|
Can someone tell me the difference between these similar dataset writing routines?
The data writing subroutine:
Private Sub New_Bindings(ByVal intOrdinal As Integer, _
ByVal strCode As String, _
ByVal strName As String)
drCurrent = MyDataSet.Tables("tblBindings").NewRow()
drCurrent!Ordinal = intOrdinal
drCurrent!BindingCode = strCode
drCurrent!BindingName = strName
MyDataSet.Tables("tblBindings").Rows.Add(drCurrent)
Call Show_Changes("Sub New_Bindings", MyDataSet)
End Sub
After each row is written into the dataset I have another subroutine that prints out the results called Show_Changes.
Case one – The data is placed directly into the subroutine call.
I’m writing 5 rows to the dataset like this:
Call New_Bindings(1, "TST1", "Record 1")
Call New_Bindings(2, "TST2", "Record 2")
Call New_Bindings(3, "TST3", "Record 3")
Call New_Bindings(4, "TST4", "Record 4")
Call New_Bindings(5, "TST5", "Record 5")
Output screen results after each row addition:
Sub - Sub New_Bindings
TableName: tblBindings
1 TST1 1 Record 1
Sub - Sub New_Bindings
TableName: tblBindings
1 TST1 1 Record 1
2 TST2 2 Record 2
Sub - Sub New_Bindings
TableName: tblBindings
1 TST1 1 Record 1
2 TST2 2 Record 2
3 TST3 3 Record 3
Sub - Sub New_Bindings
TableName: tblBindings
1 TST1 1 Record 1
2 TST2 2 Record 2
3 TST3 3 Record 3
4 TST4 4 Record 4
Sub - Sub New_Bindings
TableName: tblBindings
1 TST1 1 Record 1
2 TST2 2 Record 2
3 TST3 3 Record 3
4 TST4 4 Record 4
5 TST5 5 Record 5
This works just fine. All the records have been written to the dataset and I can use the BindingNavigator control to go from record to record.
Case 2 – The data is placed into the subroutine via variables.
Call New_Bindings(CInt(txtOrdinal.Text), txtBindingCode.Text, txtBindingName.Text)
Output screen after the same five rows are added using the data entry form.
Sub - Sub New_Bindings
TableName: tblBindings
1 TST1 1 Record 1
Sub - Sub New_Bindings
TableName: tblBindings
1 TST2 2
2 TST2 2 Record 2
Sub - Sub New_Bindings
TableName: tblBindings
1 TST3 3
2 TST2 2 Record 2
3 TST3 3 Record 3
Sub - Sub New_Bindings
TableName: tblBindings
1 TST4 4
2 TST2 2 Record 2
3 TST3 3 Record 3
4 TST4 4 Record 4
Sub - Sub New_Bindings
TableName: tblBindings
1 TST5 5
2 TST2 2 Record 2
3 TST3 3 Record 3
4 TST4 4 Record 4
5 TST5 5 Record 5
As you can see the dataset is not the same. The method of data entry is the same, except that case 2 uses variables instead of literals. Obviously .NET handles these two similar data entry methods differently, but I haven’t a clue as to how or why this occurs.
Thanks,
Quecumber256
|
|
|
|
|
Will you post your current iteration of the New_Bindings method?
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Cleako:
I'm not sure if I understand you. The current method is the New_Binding subroutine I had at the beginning of the post.
Do you want the whole form class? Code and all?
Thanks,
Quecumber256
|
|
|
|
|
hi,
good people.
I try to convert a database access in mysql server I create a dump file where I keep all the information from the access database.
When I want to create this dump file I get this error:
"The CLR has been unable to transition from COM context 0x1a6e78 to COM context 0x1a6d08 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations."
please help.
thanks
|
|
|
|
|
We'd need to see the code that is generating the error. Not the whole app, just the section where the error is being thrown.
|
|
|
|
|
Hi,
this piece of code:
sqlcode = sqlcode & "'" & conv_str(System.Text.Encoding.Default.GetString(crs.Fields(cfieldix).Value), "mysql") & "'"
return the information from a blob field
and the function where the error is being thrown is:
Private Function conv_str(ByVal str As String, ByVal provider As String) As String<br />
<br />
Dim i As Integer, nlstr As String, rstr As Object<br />
' string validation check the string for invalid characters<br />
' keep characters that have the Asci code 32-165, 192-255 and 0,8,9,10,13<br />
' fix here the euro_symbol probleme :p<br />
' provider can either be MySQL or MSSQL<br />
Try<br />
str = str.Normalize()<br />
Catch ex As Exception<br />
'remember to make a detailed report of the error here<br />
conv_str = "NULL"<br />
<br />
Exit Function<br />
End Try<br />
<br />
Dim chrCode As Long, j As Long<br />
For j = 1 To Len(str) Step 1<br />
chrCode = Asc(Mid(str, j, 1))<br />
If chrCode < 32 Then<br />
If chrCode <> 0 And chrCode <> 8 And chrCode <> 9 And chrCode <> 10 And chrCode <> 13 Then<br />
str = Left$(str, j - 1) & " " & Right$(str, Len(str) - j)<br />
End If<br />
End If<br />
If chrCode > 165 And chrCode < 192 And chrCode <> 180 Then<br />
str = Left$(str, j - 1) & " " & Right$(str, Len(str) - j)<br />
End If<br />
<br />
Next j<br />
<br />
nlstr = ""<br />
rstr = ""<br />
i = 1<br />
<br />
If (provider.ToLower() = "mysql") Then<br />
While i <= Len(str)<br />
<br />
Select Case Mid$(str, i, 1)<br />
Case Chr(0) ' ASCII NUL<br />
nlstr = ""<br />
rstr = "\0"<br />
Case Chr(8) ' backspace<br />
nlstr = ""<br />
rstr = "\b"<br />
Case Chr(9) ' tab<br />
nlstr = ""<br />
rstr = "\t"<br />
Case Chr(180)<br />
nlstr = ""<br />
rstr = " '' "<br />
<br />
Case "'"<br />
nlstr = ""<br />
rstr = "\'"<br />
<br />
Case """"<br />
nlstr = ""<br />
rstr = "\"""<br />
Case "\"<br />
nlstr = ""<br />
rstr = "\\"<br />
Case Chr(10), Chr(13) ' line feed and carriage return<br />
If nlstr <> "" And nlstr <> Mid$(str, i, 1) Then<br />
' there was a previous newline and this is its pair: eat it<br />
rstr = ""<br />
nlstr = ""<br />
Else<br />
' this is a fresh newline<br />
rstr = LINE_BREAK<br />
nlstr = Mid$(str, i, 1)<br />
End If<br />
Case Else<br />
nlstr = ""<br />
End Select<br />
<br />
If rstr <> "" Then<br />
str = Left$(str, i - 1) & rstr & Right$(str, Len(str) - i)<br />
i = i + Len(rstr)<br />
rstr = ""<br />
Else<br />
i = i + 1<br />
End If<br />
End While<br />
<br />
End If<br />
<br />
<br />
conv_str = str<br />
<br />
End Function
thanks
|
|
|
|
|
generally we write
private sub abc
end sub
In an article i read(in C#)
class class1
{
public enum one
{
g=0
}
}
then
private class1.one enum()
{
}
I was trying to do the above thing in vb.net
like
class class2
private class1.one enum()
end class
but there occured an error
End of statement expected.
|
|
|
|
|
Nilish wrote: private class1.one enum()
enum is a reserved word. I think you're looking for
Private Sub SomeMethod(ByVal var As one)
|
|
|
|
|
hi all!
Does the call of dll in multi-threading creates another thread automatically.
i have a method which is being called by a thread and in that method i am calling a function from a dll. but before the process of the dll is finished the thread goes ahead and the second thread starts which messes up the running of the program. its like.
sub method()
monitor.enter
somecode
call to a dll method
somecode
monitor.exit
end sub
Whats happening is that the dll method is doing something which takes time. but the execution of the program goes ahead and exits from the monitor, there by giving access to the next thread. which is causing problem
Regards
|
|
|
|
|
hi friends,
i am currently working on a com Addin to excel using VBA programming.
by default the excel applicaton object has no of columns as 256.
but microsoft says that no of columns is increased to 16536
i want to set the Application object property to 16536
how to do it.
thanks and regards
prashant
|
|
|
|
|
I cant reproduce this on my development machine but there is an issue on the user's machine. They will choose to edit values which sets the databinding to the textboxes and comboboxes on the form. Then they can change a value and the next row receives that ONE changed value so say there are 20 columns, the user will change column 5 and update that row and the next row also receives that one changed value.
I update the row by finding the ID in the selected row and finding that row in the datatable and updating it which works GREAT on my side and I watched the user reproduce this issue over and over and I tried it over and over on my box and nothing.
I would think that when I update the row and it also updates the one row below that it would change the entire row to match the current row but it only changes the one thing that differs.
Any ideas???
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
This is just a guess, but is sounds like you may have a zero based index problem. All indexs are zero based in .net. So if you are by chance treating them as 1 based you would be off by one row. So the first row is 0 not 1. Just a guess.
Hope that helps.
Ben
|
|
|
|
|
kubben wrote: This is just a guess, but is sounds like you may have a zero based index problem. All indexs are zero based in .net. So if you are by chance treating them as 1 based you would be off by one row. So the first row is 0 not 1. Just a guess.
I wish but I dont think so especially since I cant get it to reproduce on my end. Im not sure if I made it clear but the row being updated is updated correctly but the one change is carried over to the next row as well. I added a messagebox to show what values it was using to find the row and the values matched for that row.
Say I have an ID of 109 that is provided from the datatable so I take that value and do a Rows.Find(arrayOfValues) to get the row and do a Row.BeginEdit and Row.EndEdit . That line works great and like I said what is strange is that it only occurs on the users machine and then it doesnt replace the next line with ALL the values of the row being edited but just the changed value.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
You have probably already asked your user, but often it is a good idea to know exactly what they do to reproduce the error. I guess that is assuming that the user can reproduce the error. If there is someway to watch them or to do the exact same steps. Often they leave something out that is a clue to how the bug can be reproduced. If the user can't reproduce the bug, then it is most likely user error.
Ben
|
|
|
|
|
No I watched for 15 minutes yesterday being reproduced with an expected pattern.
There are two modes; add removes the binding to the textboxes, edit adds them back. If the user chooses edit mode and changes rows in the grid then edits a value in the textbox above and saves it then the update affects the row being edited and the next closest row so if it is the first to the 2nd to last it is the row below, if it is the last row then it is the row above. If the user edits that row twice in a row, the second edit event only affects the row itself and no other rows. So strange.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
It has something to do when sorting the columns so Im going to look into that right now and see what in the world is happening differently when they are sorted vs unsorted.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
can i add textboxes only in the first cell of datagridview?
I have four rows in the datagriddview.
I am using the following code
Private Sub dg1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dg1.CellClick<br />
If (e.ColumnIndex = 2) Then<br />
TextBox1.Visible = True<br />
TextBox1.Left = 42<br />
TextBox1.Top = 19 * (Me.dg1.CurrentCell.RowIndex + 1)<br />
<br />
TextBox1.Height = dg1.CurrentRow.Cells(0).Size.Height<br />
TextBox1.Width = dg1.CurrentRow.Cells(0).Size.Width<br />
End If<br />
End Sub
as the row index increases , the coordinates flaws increases.
|
|
|
|
|
Nilish,
why r u post this question once again
sayad answer usi post par mil jayga.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
|
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|