|
i have here a source code for MSFlexgrid to highlight a specifi cell
or object with a value of greater than 0. i want to know how i'll gonna
increment the selection in MSFlexgrid. i hope you all understand my probelm... ^^
Private Sub Form_Activate()
Dim x As Integer
`x = 2 to skip the fixrow of MSFlexgrid
x = 2
Do Until x = Data1.Recordset.RecordCount
While Data1.Recordset.EOF = False
If Data1.Recordset.Fields("Balance") = MSFlexGrid1.TextArray(x) Then
If Data1.Recordset.Fields("C_Balance").Value > 0 Then
MSFlexGrid1.CellBackColor = vbYellow
Else
MSFlexGrid1.CellBackColor = vbBlue
End If
Data1.Recordset.MoveNext
Else
Data1.Recordset.MoveNext
End If
Wend
x = x + 1
Loop
End Sub
|
|
|
|
|
Hello all,
I was trying to print the text file in vb.net (winform)
After googling i got this code...
Let me explain in detail...
I Create a file at runtime based on user request. user can print that file after viewing it.
I want to show that file in PrintPreviewDialog and if user chooses to print then it can be.
The PrintPage event i m using is as
Dim pd As New PrintDocument
AddHandler pd.PrintPage, AddressOf pd_PrintPage
'Event for printpage
Private Sub pd_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
Dim yPos As Single = 0
Dim count As Integer = 0
Dim leftMargin As Single = 0
Dim topMargin As Single = 0
Dim line As String = Nothing
linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics)
' Iterate over the file, printing each line.
While count < linesPerPage + 9 ' manipulate the pagelength according to your interest
line = streamToPrint.ReadLine()
If line Is Nothing Then
Exit While
End If
yPos = topMargin + count * printFont.GetHeight(e.Graphics)
e.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, _
yPos, New StringFormat)
count += 1
End While
Pgnum = Pgnum + 1
If Not (line Is Nothing) Then
e.HasMorePages = True
count = count + 1
yPos = topMargin + count * printFont.GetHeight(e.Graphics)
e.Graphics.DrawString("Page:" + CStr(Pgnum), printFont, Brushes.Black, leftMargin + 700, _
yPos, New StringFormat)
Else
e.HasMorePages = False
count = count + 1
yPos = topMargin + count * printFont.GetHeight(e.Graphics)
e.Graphics.DrawString("Page:" + CStr(Pgnum), printFont, Brushes.Black, leftMargin + 700, _
yPos, New StringFormat)
End If
End Sub
But i m not sure where i should add this code to show document in oreview
PrintPreviewDialog1.Document = pd
PrintPreviewDialog1.ShowDialog()
am i missing something. or completely wrong?
Thanks.........!
___________________________________________
.Net Developer
|
|
|
|
|
Hi,
I am developing Anti spyware product. I got idea on what is spyware. I have seen different softwares. In that they are searching for memory items, registry items and file items. But how to find those spyware in our system.Based on which exes and dlls we can tell spyware, malware and trojans etc. are present in our system.Please give me some idea on which dlls, exes etc will cause spyware, adware.
Thank you in advance
|
|
|
|
|
pavanip wrote: Please give me some idea on which dlls, exes etc will cause spyware, adware
That surely is what your application is trying to find out? Any file COULD contain malware, the whole point of Anti spyware software is that it looks for these.
I suspect you are biting off rather more than you can chew here.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I guess Dave Kreskowiak answer didn't make it clear enough?
Anti spyware/virus/adware/... programme's are probably one of the most difficult things to write. Since the things you are searching for are always changing and are so many.
I would suggest you start with something more simple or at the very least do alot of research before you start writing this thing
|
|
|
|
|
I have a tabcontrol with 3 pages.
I have combo with the data coming from a datatable or dataview on each tab page.
I then bind the ValueMember to a property in of a class.
Dim dvMatrix As DataView = New DataView(gMT.PLMatrix, "", "Description", DataViewRowState.CurrentRows)<br />
cboMatrixID.DisplayMember = "Description"<br />
cboMatrixID.ValueMember = "MatrixID"<br />
cboMatrixID.DataBindings.Add("ValueMember", oSettings, "MatrixID")<br />
cboMatrixID.DataSource = dvMatrix
This works fine if it is on tabpage0
If I do exactly the same objec and binding on tabpage2 I get the following error
Cannot bind to the new value member.<br />
Parameter name: value
Has anyone else run up against this issues and is there a work around.
[edit] I only get the error when I change pages to page2, not when binding. There is no onchangevent and it does not hit any of the other break points (I have one in EVERY catch block on the form)
[/edit]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am trying to complete my project with third party dll using vb.net ,
i cant call the function RDA_ReadAlarmList as below ,
this function call return a integer value and receive the RDA_ReadAlarmList Structure and RDA_AlarmSearchParam as a parameter.
Hope the bro here can help me on this , already headache for few week on this .. what --> RDS_AlarmList **outAlarmList means ?
Structure array ? How should i call this in vb.net ?
Function
10.8.1 It acquires an alarm list ( The asynchronousness ).
int WINAPI RDA_ReadAlarmList(RDS_AlarmList **outAlarmList, RDS_AlarmSearchParam *inAlarmSearchParam);
Structure
11.8.4 The alarm list search parameter
typedef struct {
RDE_SearchDir dir; The direction of the search
RDE_SearchMode mode; The browse mode
int num; The number of the searches (1-1000)
bool senser[16]; The sensor true...The sensor is valid.
int year; The year ( The 4 digit Christian era )
int month; The month (1-12)
int day; The day (1-31)
int hour; The hour (0-23)
int minute; The minute (0-59)
int second; The second (0-59)
} RDS_AlarmSearchParam;
11.8.4 The alarm list item
typedef struct {
int listNumber; The list supervision number (0-9999)
int alarmNumber; The alarm list number (1-10000)
bool isEnable; The alarm validity / the invalidity ( true: Valid, false: Invalid )
int year; The year ( 4 digits )
int month; The month (1-12)
int day; The day (1-31)
int hour; The hour (0-23)
int minute; The minute (0-59)
int second; The second (0-59)
int block; The device index
int field; The field number
int drive; The playback point drive number
int vol; The playback point VOLUME number
int camera; The camera number ( 0: The emergency, 1-: The camera number )
RDE_Alarm alarmType; The alarm type
} RDS_AlarmList;
**Superbom**
|
|
|
|
|
Let me tell you this step by step.
RDS_AlarmList is a structure, therefore
RDS_AlarmList obj1 is one object of this structure.
RDS_AlarmList *obj2 defines a pointer of this structure type.
RDS_AlarmList **obj3 defines a pointer of pointer.
A pointer of pointer is a pointer variable which can hold memory address of a pointer.
If you want to know more about pointers of pointer, I would recommend you to search on Google, it will give you links of tutorials.
-Dave.
------------------------------------
http://www.componentone.com
------------------------------------
|
|
|
|
|
In general, I would assume that the **outAlarmList indicates an array instead of just a pointer to a pointer to a single structure. The documentation of the function or some other piece of context tell you. However, you will need to declare things a little differently on the .NET side than if it was outAlarmList[]. Since the "array" seems to be an array of pointers, you will have to declare the RDS_AlarmList as a class (making sure to still mark it with the StructLayout attribute).
This single pointer to the second parameter means that you want to either declare RDS_AlarmSearchParam as a Structure and pass ByRef (the normal approach) or declare it as a Class and pass ByVal
So you should end up with this:
<StructLayout(LayoutKind.Sequential)> _
Public Structure RDS_AlarmSearchParam
<StructLayout(LayoutKind.Sequential)> _
Public Class RDS_AlarmList
<DllImport(fill in information)> _
Public Shared Function RDA_ReadAlarmList(ByVal outAlarmList() As RDS_AlarmList, _
ByRef inAlarmSearchParam as RDS_AlarmSearchParam)
|
|
|
|
|
Hi All!
I'm struggling to figure out how to add event handlers to a control at runtime, I'm looking for some code like this:
Panel1.MouseEnter = MyFunction()
That assigns MyFunction() to be called whenever Panel1 has the Cursor placed over it.
I've tried this and it doesn't work, and I can't seem to figure it out. Does anybody know how to solve this?
Thanks!
MrWolfy
|
|
|
|
|
Lookup AddHandler and RemoveHandler .
AddHandler someObject.Event, AddressOf myEventHandler
Of course, the eventhandler is going to need to have the method signature expected by the event.
|
|
|
|
|
Hi And Thanks!
Works perfectly!
Thanks Again!
MrWolfy
|
|
|
|
|
I want a grid control for a Windows Forms Project that will take a DataTable and display it vertically. For example it would take a DataTable like this:
Name Amount Due
Bob 55.65
Sue 20.33
Fred 15.18
And then display it like this:
Name Bob Sue Fred
Amount Due 55.65 20.33 15.18
I know I can get basically the same result by just flipping rows/columns in the DataTable, but I'm guessing that with very large DataTables this would not be very efficient. And I may need to use very large DataTables.
So, does anyone know of a good article of how to get started creating a control that would do this or something similar, or of a control out there that already does this? I've found some info on web versions of a grid that does this, but I've had a hard time finding anything that is specifically for a Windows Forms project. Any help would be appreciated.
|
|
|
|
|
I created a stored procedure which worked fine on Query Analyzer, except I had to load my text file locally on my "server", using this command [EXEC OrderImport 'C:\Import.txt']. Here are the problems:
1. How can I tell my stored procedure to look for my "text file" in the client, not the server?
2. On my VB codes, I have a "text box" (Txt_Path.Text) to enter the "File Path" and when I execute the stored-procedure, this file path should be included. How can I code it correctly in VB? Please look at this statement if I did it wrong "Cmd.Parameters.Append Cmd.CreateParameter("File_Path", adVarChar, adParamInput, 6, FilePath)"
Thank you again for your help.
*******This is my Stored Procedure********
CREATE PROCEDURE OrderImport
@PathFileName varchar(100) --this is my parameter for the file path
AS
DECLARE @SQL varchar(2000)
BEGIN
SET @SQL = "BULK INSERT TmpDeck_Ord FROM '"+@PathFileName+"' WITH (FIELDTERMINATOR = ',') "
END
EXEC (@SQL)
INSERT Deck_Ord (Depot_Num,Wty_Status,Ros_Num )
select Depot_Num, Wty_Status, Ros_Num
FROM tmpDeck_Ord
TRUNCATE TABLE TmpDeck_Ord
GO
******and this is my VB codes********************
Option Explicit
Dim Con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim Cmd As ADODB.Command
Dim FilePath, StrConnect As String
Private Sub Cmd_get_Click()
FilePath = Txt_Path.Text
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = Con
Cmd.CommandType = adCmdStoredProc
Cmd.CommandText = "OrderImport"
Cmd.Parameters.Append Cmd.CreateParameter("File_Path", adVarChar, adParamInput, 6, FilePath)
Set rs = Cmd.Execute
Set Cmd.ActiveConnection = Nothing
End Sub
Private Sub Form_Load()
StrConnect = "Database=myDB;SERVER=myServer;DRIVER={SQL SERVER};"
Con.Open StrConnect, "sa", "password"
End Sub
PNH
|
|
|
|
|
phn110 wrote: 1. How can I tell my stored procedure to look for my "text file" in the client, not the server?
You can't. The server's SQL accounts are not going to have any permissions to the filesystem of the local workstation.
|
|
|
|
|
Dave, thank you for your reply.
How can I work around that with VB app.? I used a "FilePath" as a parameter in the stored procedure. Thanks in advance for your help.
PNH
PNH
|
|
|
|
|
If this is storing the contents of the file in a column of a table, you send the file contents, not the file path.
Google for "VB.NET SQL database image" for examples. It doesn't matter what type of file is involved. The technique is the same.
|
|
|
|
|
Whenever I try to connect to visual source safe database i get an error message "Access is denied for rights.dat from the network computer", even though the full rights has been given for the shared folder where the database is located.
Please help
|
|
|
|
|
Hi,
To resolve this problem, build a new Um.dat file. Note that when you build a new Um.dat file, you must add all of the users again.
1. To build a new Um.dat file, follow these steps: 1. Create a temporary folder named C:\Sstemp.
2. Click Start, click Run, type cmd, and then click OK.
3. Go to the VSS\Win32 folder in the command prompt window, and then type the following command:
mkss c:\sstemp
4. In the VSS\Win32 folder at the command prompt, type the following command:
ddconv c:\sstemp
5. In the VSS\Win32 folder at the command prompt, type the following command:
ddupd c:\sstemp
6. Copy the Um.dat file from the C:\SStemp\Data folder to the Visual SourceSafe data directory.
7. Rename the Rights.dat file in the Visual SourceSafe data directory as Rights2.dat.
8. At a command prompt, run the analyze -f command against the database.
9. Add all of the Visual SourceSafe users again.
10. Reassign rights to the Visual SourceSafe users.
Hope this would fix the issue: ).
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
In my company we've got a fairly old VB6 application (roots go back to 1998, VB6, DAO, Paradox). About two years ago, we added some import / export functions. We used VB.Net and Ado.Net. Works like a charm in countries with Western European charsets.
Now these import / export functions were requested in Russia. Now here is trouble:
- most Cyrillic letters are above ASC 128
- DAO 3.5 uses mspdox35.dll to read and write Paradox Data
- Ado.net uses the BDE if installed (via mspbde40.dll)
- the way mspdox35.dll and BDE store and retrieve character data with codes above 127 is incompatible.
Here is what I tried so far:
(1) Changed the Paradox Table Language from "Paradox 'intl'" to "Pdox ANSI Cyrillic". Data read and write for Ado.net (via mspbde40.dll and BDE) is okay, but I can't access those tables with DAO (Exception 3274, External table isn't in the expected format).
(2) Forced mspbde40.dll to read and write the data itself (HKLM\SOFTWARE\Microsoft\Jet\4.0\Engines\Paradox BDE = 0x2 (REG_DWORD)). The characters are OK but the performance is unacceptable (Insert of 255 records takes ~ 50 seconds! For comparison: via BDE the same code runs in about 20 seconds).
Other things I tried which didn't show any effect:
- Changed the Paradox LangDriver in the BDE Administrator
- Used the OleDb*-classes instead of the Odbc*-classes
For the heck of it I wrote a routine in VB.NET using DAO. Works and is bindingly fast (< 1 second!). Now what should I do?
(a) rewrite all data access routines to use DAO? Since the import / export is fairly complex this would take a week or so.
(b) write a custom DataProvider (implementing IDbConnection, IDbCommand, etc.) bridging to DAO? Has anybody already done that?
(c) Find the switch that makes mspbde40.dll's own Paradox routines so awfully slow. My suspicion: tables can't be locked exclusively. Also bulk updates (UpdateBatchSize > 1) aren't supported by mspbde40.dll.
(d) ??? Any hint is welcome!
Regards
Martin
|
|
|
|
|
Don't go back to DAO. It's a dead technology and hasn't been supported for years.
It still exists in Windows though, so you can write a utility to convert and upgrade the database. Use the old DAO technology to read your old database, then write the upgraded database with ADO.NET.
|
|
|
|
|
Hi Dave!
Thanks for the answer. To convert the whole application to ADO.NET is not an option, though. The application is near the end of it's life cycle and we won't invest months to switch to current data access technology.
All I want is that my .NET import / export library stores and retrieves character data in a DAO compatible way - with acceptable performance.
Regards
Martin
|
|
|
|
|
If this is just a small request, then you can still use the DAO technology to do this. There's nothing wrong with that. I just wouldn't like to see you dump all kinds of time into new development, or an app that's still has a pretty lengthy life still in it, just to see DAO disappear from the next release of Windows or get ripped out by some service pack or patch.
|
|
|
|
|
|
pavanip wrote: I am developing one application like Anti spyware
pavanip wrote: And what is adware,Trojans, Malware, Keylogger.
If you don't know what this is, you don't have the slightest bit of hope of writing this. It's not just know what these things are, it's also knowing how these things work, how they hide themselves, what clues you're looking for to find these things, how you're search engine is going to work, how you're going to store the information you need to find these apps, ...
In order to write an application like this, you're going to need forensic-level knowledge of how these apps work and how Windows works. And here you're asking how to do something as simple as reading the registry?? I hate to rain on your parade, but your skillset isn't advanced enough to even attempt this app, yet.
|
|
|
|
|