|
There is nothing much special about the panel, except it should be a DoubleBufferedPanel.
I know of three ways to get it on the Form:
1.
make sure that class is already compiled (maybe in a separate DLL) and you can design it in with Visual Designer. This is the official approach.
2.
or add a Panel with Visual Designer, close the Form, and edit the form.designer.cs file changing new Panel() into new DoubleBufferedPanel()
(not recommended, one isn't supposed to edit a designer file)
3.
or add a Panel with Visual Designer, and have it replaced at run-time. That is what I did, like so, in the Form's constructor.
Panel oldPlot=plot;
plot=new DoubleBufferedPanel();
plot.Bounds=oldPlot.Bounds;
Controls.Remove(oldPlot);
Controls.Add(plot);
plot.Paint+=plotter;
The disadvantage is you have to copy all Designer properties/events from the old to the new Panel.
The alternative is to leave the Panel, and turn it into a double-buffered one by setting some ControlStyles (the DoubleBuffered property being protected cannot be modified).
|
|
|
|
|
Hello Experts,
Good day/Good Evening Experts I am here again to ask some few questions.
I would like to ask if why does my sqldataAdapter do not refresh the query it fill my datatable.
I am making a borrow transaction for borrowing a book where in a student or ... borrow. The quantity of book will decrease depending on the quantity of book borrowed.My problem is that my sqlDataAdapter to load the table of my bookRecords does not refresh what it need to fill.Confuse why does it refresh my sql query.
Below here is my code:
'save the borrow transaction
Public Sub SaveBorrowTransaction(ByVal txtBorrowerID As TextBox, ByVal txtLastName As TextBox, _
ByVal txtFirstName As TextBox, ByVal txtMI As TextBox, _
ByVal txtContactNo As TextBox, ByVal cboPosition As ComboBox, _
ByVal txtYear As TextBox, ByVal txtSection As TextBox, _
ByVal txtLibrarianLastName As TextBox, ByVal txtLibarianFirstName As TextBox, _
ByVal txtLibrarianMI As TextBox, ByVal cboNoOfDays As ComboBox, _
ByVal txtTransactionID As TextBox, _
ByVal lvItems As ListView, ByVal con As SqlConnection)
Try
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim da As New SqlDataAdapter
con.Open()
da = New SqlDataAdapter("Select * from BorrowTransactionTable", con)
da.Fill(dt)
Dim dt2 As New DataTable
Dim ds2 As New DataSet
ds2.Tables.Add(dt2)
Dim da2 As New SqlDataAdapter
da2 = New SqlDataAdapter("Select * from transactionitemstable", con)
da2.Fill(dt2)
Dim dt3 As New DataTable
Dim ds3 As New DataSet
ds3.Tables.Add(dt3)
Dim da3 As New SqlDataAdapter
Dim j As Integer = 0
While j <> lvItems.Items.Count
'for borrow transaction Dim newRow As DataRow = dt.NewRow
With newRow
.Item("txtTransactionID") = txtTransactionID.Text
.Item("txtBorrowerID") = txtBorrowerID.Text
.Item("txtLibrarianLastName") = txtLibrarianLastName.Text
.Item("txtLibrarianFirstName") = txtLibarianFirstName.Text
.Item("txtLibrarianMI") = txtLibrarianMI.Text
.Item("txtLastName") = txtLastName.Text
.Item("txtFirstName") = txtFirstName.Text
.Item("txtMI") = txtMI.Text
.Item("txtSection") = txtSection.Text
.Item("txtYear") = txtYear.Text
.Item("txtContactNo") = txtContactNo.Text
.Item("txtPosition") = cboPosition.Text
.Item("txtItemNO") = lvItems.Items(j).SubItems(0).Text
.Item("txtRemarks") = "Borrowed"
.Item("intNoDay") = Val(cboNoOfDays.Text)
.Item("intQuantity") = 1
'update changes to quantity of book catalogue records when borrowing///////////////////
da3 = New SqlDataAdapter("Select * from BookCatalogueTable where txtAccessionNo='" & lvItems.Items(j).SubItems(0).Text & "'", con)
da3.Fill(dt3)
dt3.Rows(0).BeginEdit()
dt3.Rows(0).Item("intQuantity") = Val(dt3.Rows(0).Item("intQuantity")) - 1
dt3.Rows(0).EndEdit()
Dim cb3 As New SqlCommandBuilder(da3)
da3.Update(dt3)
.Item("dateDateBorrow") = Now.Date
.Item("dateDueDate") = Now.AddDays(Val(cboNoOfDays.Text))
.Item("dateDateTransaction") = Now.Date
End With
dt.Rows.Add(newRow)
Dim cb As New SqlCommandBuilder(da)
da.Update(dt)
'for transaction items Dim newrow2 As DataRow = dt2.NewRow
With newRow2
.Item("txtTransactionNo") = txtTransactionID.Text
.Item("txtItemNo") = lvItems.Items(j).SubItems(0).Text
.Item("txtItemTitle") = lvItems.Items(j).SubItems(1).Text
.Item("txtItemAuthor") = lvItems.Items(j).SubItems(2).Text
.Item("txtItemDecription") = lvItems.Items(j).SubItems(3).Text
.Item("txtTransactionStatus") = "Borrow"
End With
dt2.Rows.Add(newrow2)
Dim cb2 As New SqlCommandBuilder(da2)
da2.Update(dt2)
j = j + 1
End While
con.Close()
MsgBox("Transaction is Complete")
Catch ex As Exception
MsgBox(ex.ToString)
con.Close()
End Try
End Sub
Any Comments or Suggestion are so much appreciated.
Thanks,
Dan
|
|
|
|
|
Which of the three DataAdapters are you asking about? What are you expecting to happen? It doesn't even appear you are using the first one. You are creating DataSets then never using them. I would say this could also be handled better with a stored procedure. And lastly, you're using VB
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hello,
Sorry bout not giving good info for my question, the problem came from my 3rd dataAdapter
at this part:
'update changes to quantity of book catalogue records when borrowing///////////////////
da3 = New SqlDataAdapter("Select * from BookCatalogueTable where txtAccessionNo='" lvItems.Items(j).SubItems(0).Text & "'", con)
da3.Fill(dt3)
dt3.Rows(0).BeginEdit()
dt3.Rows(0).Item("intQuantity") = Val(dt3.Rows(0).Item("intQuantity")) - 1
dt3.Rows(0).EndEdit()
Dim cb3 As New SqlCommandBuilder(da3)
da3.Update(dt3)
My da3 suppose to load again the new query while its on a loop block so that I can Subtract those quantity value,but my da3 doesn't refresh the query that will load new records.
For example my da3 select query at first is "Select * from BookCatalogueTable where txtAccessionNo='1'". After I update the table the new da3 select query for example become "Select * from BookCatalogueTable where txtAccessionNo='2'".My da3 does not execute the next query instead it still using the first query.
If my question is not yet clear I can still clarify to the best I can.
I'm really confuse why my da3 doesn't load the new query.
All comments and suggestion are soo much appreciated.
Thanks,
Dan
|
|
|
|
|
As I said, this is better handled with other methods, i.e. not using a DataAdapter for everything. You creating far too much overhead and I'm sure your code doesn't perform well. Use a stored proc to handle this, or use SqlCommands directly.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hello experts,
I would like to ask if how can I show some specific records only in my listview coming from my database
table.My Database is Sql Server 2005 and I am using vb 2008 as the programming language.
Scenerio:
BorrowTable
ID | Last Name |
1 | mrDan
1 | mrDan
2 | mrsDan
2 | mrsDan
I have a table in my database with name BorrowTable as shown above for example, my problem is I would
like to show the transaction records of people in table.To be more precise bec I cant so much
explain my problem I want to display it like this way in my listview
ID | Last Name |
1 | mrDan
2 | mrsDan
Below here is the code, its working but it just show all the records I have tried "group by" as select query to my sqlDataAdapter but it's not working.
Public Sub LoadListViewReturn(ByVal lvReturnList As ListView, ByVal con As SqlConnection)
Try
If con.State = ConnectionState.Open Then
con.Close()
End If
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim da As New SqlDataAdapter
con.Open()
da = New SqlDataAdapter("Select * from BorrowTransactionTable ", con)
da.Fill(dt)
For Each r As DataRow In dt.Rows
lvReturnList.Items.Add(r("txtTransactionID"))
lvReturnList.Items(lvReturnList.Items.Count - 1).SubItems.Add(r("txtLastName"))
lvReturnList.Items(lvReturnList.Items.Count - 1).SubItems.Add(r("txtFirstName"))
lvReturnList.Items(lvReturnList.Items.Count - 1).SubItems.Add(r("txtMI"))
lvReturnList.Items(lvReturnList.Items.Count - 1).SubItems.Add(r("txtPosition"))
Next
con.Close()
Catch ex As Exception
MsgBox(ex.ToString)
con.Close()
End Try
End Sub
Any comments and suggestions are so much appreciated.
Thanks,
Dan
|
|
|
|
|
So you want the DISTINCT[^] keyword. You'd better replace the asterisk by the actual list of fields you want returned then, and specify which of those MUST be distinct.
|
|
|
|
|
Hello,
Thank you so much this is really the answer I was looking for
Thanks also the link it was super helpfull.Now I can finish the System I am doing,
I am stuck in that part due to filtering my listview.
Thank so much,
Dan
|
|
|
|
|
You're welcome.
|
|
|
|
|
So, my neighbor, who I didn't realize knew I was a 'computer person' came around last night and asked if I would be able to take a look at a friends USB drive to see if I could get anything off it. Wanting to make friends with my neighbors I said I could take a look. So, if the USB drive isn't being recognized (what I would think most users would term "not working"), then unless her USB controller fried, I'm going to have a hard time investigating something I can't communicate with.
That aside, it got me onto the thought of file recovery. So, I have a few questions;
Is .NET able to communicate with hardware at a low enough level that I could query the contents of a piece of hardware? (I know about the IO namespace and the ability to enumerate drives etc.). If not, am I picking back up C++?
How do I go about finding resources on teaching me how to investigate, verify and re-assemble(if necessary) files. I went 4-5 pages into google searches and was just seeing data-recovery software/companies.
|
|
|
|
|
hammerstein05 wrote: Is .NET able to communicate with hardware at a low enough level that I could query the contents of a piece of hardware?
If there's an API for it, you can p/invoke it. Bear in mind that C++ will use the API then .NET should be able to - I'm not saying that it's the right tool for the job, but you can do it.
|
|
|
|
|
|
You might want to post this against the OP so that they receive the email. They won't be notified of your reply to my answer.
|
|
|
|
|
D'oh!! Good point
edit : had to remove previous message - seems I can't post the same message twice.
Days spent at sea are not deducted from one's alloted span - Phoenician proverb
modified on Wednesday, September 22, 2010 10:44 AM
|
|
|
|
|
Although you could roll your own, you might be quicker to use one of the off-the-shelf recovery programmes - I think writing something like this would be a pretty major undertaking.
Here are a couple of pretty good packages which might get your neighbour's data back fairly quickly :-
PhotoRec[^] comes highly recommended, and should deal with most types of media, and most types of file.
Foremost[^] is also worth a look...
Days spent at sea are not deducted from one's alloted span - Phoenician proverb
|
|
|
|
|
Oh, If the drive is that bad I will be suggesting a third party tool.
My questions were mainly based around making this a research project for myself, no timescales. I'm interested in understanding. Whenever I see pieces of software where people charge such a varying amount for, I'm always curious as to the true effort involved. I don't expect this to be a 3 hour coding project, but I would like to find more reading material on it
|
|
|
|
|
Hi,
does anyone know a free .NET crypter/protector? My problem is, that there are many free obfuscators I could use, but with obfuscation all the code (also in Log and Tracefiles) is blurred and our developement team is no longer able to assigne the error codes to a function.
So, does anyone know of a possibility to obfuscate code without blurring special function names? A tool, which just obfuscates the "in-function" code like algorithms?
Or is there maybe a completely different solution for my problem?
Thanks for any advice!
Cheers, cheery
|
|
|
|
|
What you want is near to impossible, or at least very difficult. I believe professional obfuscation tools might be able to do what you need, at least partially, but you can't get those for free.
Anyway, no obfuscation algorithm can protect your code. If you keep your method names unchanged - probably because you need descriptive names - then your code cannot really be obfuscated. A good descriptive method name pretty much says what the method does (that's its purpose, in the end), which helps a lot to any potential reverse-engineer.
As for the method body, automatic obfuscation usually only consists of renaming all identifiers and a few more well-defined steps. The algorithm has no knowledge of your code and it can only do very little because it must not break your code.
|
|
|
|
|
There is control-flow obfuscation though
|
|
|
|
|
spaghettization?
|
|
|
|
|
cherrymotion wrote: all the code (also in Log and Tracefiles) is blurred and our developement team is no longer able to assigne the error codes to a function.
They're using reflection to determine the name of the current function? How about replacing those with encrypted constants? Should be easy to decrypt. Wouldn't recommend on doing that change manually though; best to create a small app that modifies the current source-files.
cherrymotion wrote: Or is there maybe a completely different solution for my problem?
There's no solution, merely patches.
I are Troll
|
|
|
|
|
Currently, my IT department has rolled out to my user community the following CasPol.exe setting:
"c:\Windows\Microsoft.NET\Framework\v1.1.4322\CasPol.exe" -m -ag All_Code -url http://ProdServer/App1/* FullTrust -n App1
The new version of the application says that the following CasPol.exe command needs to be executed because the application is now a .NET 2.0 application.
"c:\Windows\Microsoft.NET\Framework\v2.0.50727\CasPol.exe" -m -ag All_Code -url http://ProdServer/App1/* FullTrust -n App1
Is this really necessary ?
I have to roll out the new version of the application to 70 desktops and this would require that the CasPol.exe command be issued to all of those users. (The users are not local Admins, so it may be a bit tricky to run in a logon script.) Right ?
Cheers.
David
|
|
|
|
|
Well, I finaaly had to upgrade the system and YES, I did have to go to each desktop and run the CasPol.exe command under .NET 2.0 in order for it to work.
Just wanted to let everyone know what the answer was.
|
|
|
|
|
Hi All,
I have Typed Datasets, I am creating Table Adapters for them. What I want is, I want to create the table adapters with parameters. Is there any way to create table adapters
with parameters and with relations. So that, if we select a specific department in "dept" table then the Employee table adapter also picks only those employees from "Employee"
table who belongs to that particular dept.
Is there any way please help me in this regards, I am new to Typed Datasets. Any links or suggestions will be of great help.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
indian143 wrote: Any links
There's a Howto[^] article and the general overview[^] on MSDN that might be helpfull. You can change the version of the targeted framework with the link on top of the page.
I are Troll
|
|
|
|