
techmanbd
Avatar/Signature-
Posts
405 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by techmanbd
-
Are you running 2005 version? 2003 I don't think has that as I looked around so I have to do what MrPaul said and also have to set the FlatStyle properties to "System", If I want to. But since we are still on Windows 2000,:mad: it doesn't work on it.
-
I am looking to use a graph in my project. Does anyone use graphs here and what did you use? I looked through the ToolBar .Net Framework Components and I did not see anything there. I am looking through COM Components. But if anyone can give me some advice, that would be appreciate. Just a quick example of what I will use it for. I want Y to = Voltage and X = time. It will change when one test is done to different time for X for the next test so I will need to be able to change that.
-
My Datasource is xml How can Crystal Reports Help me?
techmanbd replied to vbMarkO's topic in Database / XML / Reporting
I was thinking too, you may want to look into xml schema as well imports system.data imports system.xml Dim strDataXSD As String = AppDomain.CurrentDomain.SetupInformation.ApplicationBase & "HBLabSpec.xsd" Dim strDataXML As String = AppDomain.CurrentDomain.SetupInformation.ApplicationBase & "HBLabSpecData.xml" dsGetID.ReadXmlSchema(strDataXSD) dsGetID.ReadXml(strDataXML, XmlReadMode.DiffGram) -
My Datasource is xml How can Crystal Reports Help me?
techmanbd replied to vbMarkO's topic in Database / XML / Reporting
Hi vbMark0, I use xml files for storing parameters for tests. But basically same general idea as it is data and sometimes I change items and save. Maybe this can help you. Here is some of my code and hopefully get you where you need to go. It all depends on where you want to put things as well. I will give my examples and maybe you can massage it into your needs. I use dataset and dataview. first I dim a dataset when the form loads Dim dsData As New DataSet Then while form is loading. Private Sub frmCalibration_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load dsData.ReadXml(strPath & "HBLabDevices.xml") 'strPath = where the folder is of where my xml file is located end sub This is a sub where I read from the xml file Private Sub GetCalOffset() Dim dvData As New DataView Me.PT.arryVrmsOffsets.Clear() With dvData .Table = dsData.Tables("outputcal") If .Table.Rows.Count <> 0 Then For intX As Integer = 1 To (.Table.Columns.Count) Me.PT.arryVrmsOffsets.Add((.Item(0).Item("offsetfreq" & intX.ToString))) Next End If End With End Sub then through another sub, I use an array list to gather data then goto this to save it Private Sub savedata(ByVal strSineOrSquare As String) Try Select Case strSineOrSquare Case "square" dsData.Tables("outputcalsquare").Rows(0).Item("offsetpeak") = _ (Convert.ToDouble(Me.txtGenOut.Text) - Convert.ToDouble(Me.txtOutFromOscope.Text)).ToString Case "sine" For intX As Integer = 0 To (Me.arryNewOffset.Count - 1) dsData.Tables("outputcal").Rows(0).Item("offsetfreq" & (intX + 1)) = Me.arryNewOffset(intX) Next End Select dsData.AcceptChanges() dsData.WriteXml(strPath & "HBLabDevices.xml") Catch ex As Exception MessageBox.Show(ex.Message & vbCr & "Unable to save data. Check if file exists!", "Data Save Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Then when I exit this form I do this Private Sub frmCalibration_Close(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Closed dsData.Dispose() End Sub Here is another sub I have in a different form that is all in one sub, I open and look at data and if I need to change then it changes the data to the xml form. Private Sub SetUpVrmsForNewFreq(ByVal intFreqNo As Integer, ByVal strVDCOffset As String) Dim dsDataOffset As New DataSet Dim dvDataOffset As New DataView Dim dblVoltRead As Double Dim dblExpected As Double = Me.PT.dblGenVrms Dim boolReady As Boolean = False Dim strNewOffset As String Dim strNextVolt As String = (Convert.ToDouble(Me.PT.arryVrmsOffsets(intFreqNo)) + dblExpected).ToString dsDataOffset.ReadXml(PT.strPath & "HBLabDevices.xml") With dvDataOffset .Table = dsDataOffset.Tables("outputcal") .RowFilter = "offsetbplus = '" & strVDCOffset & "'" End With Do Me.PT.comportwrite(Me.PT.comFuncGen, "VOLT " & strNextVolt & ";") Me.FGSysErr() dblVoltRead = Me.GetMMVAC Me.lblInfoCenter.Text = "Adjusting Vrms to " & Me.PT.dblGenVrms.ToString & "." & vbCr _ & "Currently @ " & Format(dblVoltRead, "#.###") If dblVoltRead > (dblExpected + (dblExpected * 0.02)) Or dblVoltRead < (dblExpected - (dblExpected * 0.02)) Then If dblVoltRead > (dblExpected + (dblExpected * 0.02)) Then strNextVolt = Format((Convert.ToDouble(strNextVolt) - 0.002), "##.###") Else strNextVolt = Format((Convert.ToDouble(strNextVolt) + 0.002), "##.###") End If Else boolReady = True End If doeventit() Loop While Not boolReady strNewOffset = Convert.ToDouble(strNextVolt) - dblExpected Me.PT.arryVrmsOffsets.RemoveAt(intFreqNo) Me.PT.arryVrmsOffsets.Insert(intFreqNo, strNewOffset) For intX As Integer = 0 To (Me.PT.arryVrmsOffsets.Count - 1) dvDataOffset.Item(0).Item("offsetfreq" & (intX + 1).ToString) = Me.PT.arryVrmsOffsets(intX) Next dsDataOffset.AcceptChanges() dsDataOffset.WriteXml(PT.strPath & "HBLabDevices.xml") dvDataOffset.Dispose() dsDataOffset.Dispose() I know it is alot to read but I am hoping this will help you out. I can't remember where I found how to use datasets and dataviews with xml files. I would try googling those terms, I believe that is how I found it. Oh yeah, this actually may help, my xml for data <?xml version="1.0" standalone="yes" ?> <HBLabSpec xmlns="http://tempuri.org/HBLabSpec.xsd"> <LabDevice> <Address>6</Address> <Device>functiongen</Device> </LabDevice> <LabDevice> <Address>22</Address> <Device>mmeter</Device> </LabDevice> <frequency> <freq1>70</freq1> <freq2>100</freq2> <freq3>400</freq3> <freq4>3000</freq4> <freq5>10000</freq5> </frequency> <outputcal> <offsetbplus>normalvdc</offsetbplus> <offsetfreq1>-0.26</offsetfreq1> <offsetfreq2>-0.257</offsetfreq2> <offsetfreq3>-0.256</offsetfreq3> <offsetfreq4>-0.253</offsetfreq4> <offsetfreq5>-0.253</offsetfreq5> </outputcal> <outputcal> <offsetbplus>hivdc</offsetbplus> <offsetfreq1>0.4</offsetfreq1> <offsetfreq2>0.4</offsetfreq2> <offsetfreq3>0.7</offsetfreq3> <offsetfreq4>1.0</offsetfreq4> <offsetfreq5>1.1</offsetfreq5> </outputcal> <outputcal> <offsetbplus>lovdc</offsetbplus> <offsetfreq1>0.4</offsetfreq1> <offsetfreq2>0.4</offsetfreq2> <offsetfreq3>0.7</offsetfreq3> <offsetfreq4>1.0</offsetfreq4> <offsetfreq5>1.1</offsetfreq5> </outputcal> <outputcalsquare> <offsetpeak>0</offsetpeak> </outputcalsquare> <Diagnostics> <boolOn>true</boolOn> //if set to 'true' then at start up, will turn on diagnostics logging. Set to 'false' to turn off. </Diagnostics> </HBLabSpec> -
Hmm. I was looking in my applications and realized I don't have the datagridview1. Are you running 2005 version? I am running VS 2003 version. That is probably why I needed to make that class.
-
I just finished doing this exact thing. You need to make a special class to repaint the cell, and also call it in the program for the datagrid. Here is my code you can look at and hopefully this will help get you started. In the Class ColoredTextBoxColumnResult is where you do the comparison to change the color of the cell. You see mine, but I am sure you will have different comparisons. But I left mine in there as an example. You can also read this to give you a better explanation of why it is done this way http://msdn2.microsoft.com/en-us/library/aa289506(VS.71).aspx this routine formats the columns for the colors. Calls from the class I put in below. When I set up everything say at load. You need to call like so. me.FormatGridColumns() me.CompleteDataGrid() Private Sub FormatGridColumns() Me.datResult.TableStyles.Clear() Dim tsProducts As New DataGridTableStyle Dim tbcChan As DataGridTextBoxColumn Dim ctbcResult(12) As ColoredTextBoxColumnResult Dim intLoop As Integer tbcChan = New DataGridTextBoxColumn With tbcChan .MappingName = "Channels" .HeaderText = "Channels" .Width = 100 .Alignment = HorizontalAlignment.Center End With If Me.PT.arryFreqs.Count <> 0 Then For intLoop = 1 To Me.PT.arryFreqs.Count ctbcResult(intLoop) = New ColoredTextBoxColumnResult With ctbcResult(intLoop) .MappingName = "freq" & intLoop.ToString .HeaderText = Me.PT.arryFreqs.Item(intLoop - 1) .Width = 100 .Alignment = HorizontalAlignment.Center End With Next End If tsProducts.MappingName = "results" tsProducts.GridColumnStyles.Add(tbcChan) If Me.PT.arryFreqs.Count <> 0 Then For intLoop = 1 To Me.PT.arryFreqs.Count tsProducts.GridColumnStyles.Add(ctbcResult(intLoop)) Next End If Me.datResult.TableStyles.Add(tsProducts) tsProducts.Dispose() End Sub Set up my datagrid Private Sub CompleteDataGrid() Me.datResult.DataSource = Nothing Me.datResult.CaptionText = "Results in dB" Dim objCellVal As Object Dim intL As Integer Dim intLC As Integer Dim strR As String Dim dt As New DataTable Dim dr As DataRow Dim dv As DataView = New DataView With dt .TableName = "results" .Columns.Add("Channels") For intL = 1 To PT.arryFreqs.Count .Columns.Add("freq" & intL.ToString) Next End With With dv .Table = dt For intL = 1 To PT.arryChansTested.Count dr = .Table.NewRow .Table.Rows.Add(dr) Next End With With Me.datResult .DataSource = dv For intL = 0 To (PT.arryChansTested.Count - 1) For intLC = 0 To (PT.arryFreqs.Count) If intLC = 0 Then strR = PT.arryChansTested(intL) objCellVal = strR.Substring(0, strR.IndexOf(":")) Else objCellVal = 0 End If .Item(intL, intLC) = objCellVal Next Next End With End Sub repaint class Public Class ColoredTextBoxColumnResult Inherits DataGridTextBoxColumn Dim passthruVar As PassThru Protected Overloads Overrides Sub Paint(ByVal graph As Graphics, _ ByVal rectbounds As Rectangle, ByVal curmngrSrc As _ CurrencyManager, ByVal RowNumber As Integer, ByVal _ ForeColorBrush As Brush, ByVal BackColorBrush As Brush, _ ByVal AlignmentRight As Boolean) Dim ObjVal As Object ObjVal = Me.GetColumnValueAtRow(curmngrSrc, RowNumber) If Not (IsNothing(ObjVal) Or IsDBNull(ObjVal)) Then If IsNumeric(ObjVal) Then Dim dblUL As Double Dim strMap As String = Me.MappingName Dim cellValue As Double = Convert.ToDouble(ObjVal) Dim intCol As Integer = Convert.ToInt32(strMap.Substring(strMap.IndexOf("q") + 1)) If intCol <> 0 Then dblUL = Convert.ToDouble(Me.passthruVar.arryDBs(intCol - 1)) End If If dblUL > 0 Then dblUL = (dblUL * -1) End If If cellValue = 0 Then BackColorBrush = Brushes.LightGray ForeColorBrush = Brushes.Black ElseIf (cellValue > dblUL) Or (cellValue < -90) Then BackColorBrush = Brushes.Red ForeColorBrush = Brushes.Black Else BackColorBrush = Brushes.Green ForeColorBrush = Brushes.Black End If Else BackColorBrush = Brushes.Gray ForeColorBrush = Brushes.Black End If Else BackColorBrush = Brushes.Gray ForeColorBrush = Brushes.Black End If ' Call Paint from the base class to ' accomplish the actual drawing. MyBase.Paint(graph, rectbounds, curmngrSrc, RowNumber, _ BackColorBrush, ForeColorBrush, AlignmentRight) End Sub
-
I too have the same problem. I was just getting ready to post the same thing. the banner i see and have the problem is the dotnetpanel one.
-
I am programming a test application that uses the parallel port. I am using a 3rd party OCX and need the resource setting numbers for LPT1. This is the number you see in the Device Manager Resources for LPT1. I have never done this and have been searching here and google without luck, maybe searching with the wrong wording. How would I do this or at leats point me in the correct direction. Thanks.
-
Your IP changes if you have a basic account when you log on. Also blocking certain type of email is possible. The one site I am on, we would see something and I would do a check to make noone else was on that type and would block any email addresses with the same ending. But then they get smart and started using hotmail or yahoo accounts. Problem with that is we would lose alot of legitimate posters. I use a yahoo account. I believe the spamming on forums have increased, because the email blocking is getting much better.
-
This happens on a vehicle forum I admin. I belive they get paid to do this. We get the same exact spam by different email addresses, and alot of times, it is a close email name, such as abc123@whatever.com, then next time it is abc124@whatever.com. It gets very frustrating to keep the board clean from this crap.
-
What do you use for a graph on the form? I don't see anything in the tools section. I am pulling data from a text file and want to plot a graph for the user to see.
-
So I understand, you want to know the postion of the cursor when over the picturebox while not clicking correct? If so check this out. Then hit F1 key to get the help for MouseHover Private Sub panel1_MouseHover(sender As Object, e As System.EventArgs) Handles panel1.MouseHover 'code here for events you want, as in location of the cursor over the picture box. End Sub
-
Maybe this can help. Here is what I do for a pause button that when pressed again, my test continues. Somewhat the same concept of what you are asking. Private Sub btnPauseTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPauseTest.Click If Me.btnPauseTest.Text = "PAUSE" Then If thrdTest.IsAlive Then thrdTest.Suspend() Me.tmrTestTime.Enabled = False Me.btnPauseTest.Text = "CONTINUE" Else If thrdTest.IsAlive Then thrdTest.Resume() Me.tmrTestTime.Enabled = True Me.btnPauseTest.Text = "PAUSE" End If End Sub
-
Edit: Woops, sorry. Somehow I posted in the wrong thread
-
Nope, I didn't realize that, sorry. I didn't have that in my toolbar, until now. I will check it out.
-
OK, here you go. In this example, You need to make a public class that inherits DataGridTextBoxColumn. Then on load up, I format the grid columns. If you notice, in my sub, The first column, It is a basic column because I am not changing colors in that one. It is just for frequencies. But the next 12 columns, I make from the public class. Since those are the ones I want to compare for color change. A little long, but hope this helps you get to what you need. My code is below, and here is a link to where I was able to get my color change in indivual cells from. They also have some format examples. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchFormattingWindowsFormsDataGridVisualBasicPrimer.asp Public Class frmHBmain Inherits System.Windows.Forms.Form Private Sub frmHBmain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.FormatGridColumns() Me.SetUpDatagrids() End Sub Private Sub FormatMyGrids Dim tsProducts As New DataGridTableStyle Dim tbcSerialNumber As DataGridTextBoxColumn Dim ctbcResult(12) As ColoredTextBoxColumnResult Dim intLoop As Integer tbcSerialNumber = New DataGridTextBoxColumn With tbcSerialNumber .MappingName = "frequency" .HeaderText = "Frequency" .Width = 60 .Alignment = HorizontalAlignment.Center End With For intLoop = 1 To 12 ctbcResult(intLoop) = New ColoredTextBoxColumnResult With ctbcResult(intLoop) .MappingName = "ch" & intLoop.ToString .HeaderText = "CH" & intLoop.ToString .Width = 40 .Alignment = HorizontalAlignment.Center End With Next tsProducts.MappingName = "Vrms" tsProducts.GridColumnStyles.Add(tbcSerialNumber) For intLoop = 1 To 12 tsProducts.GridColumnStyles.Add(ctbcResult(intLoop)) Next Me.datResult.TableStyles.Add(tsProducts) tsProducts.Dispose() end sub Private Sub SetUpDatagrids() Me.datResult.DataSource = Nothing Me.datResult.CaptionText = "Result in dBs" Dim objCellVal As Object Dim intLoop As Integer Dim intLoopChan As Integer For intX As Integer = 1 To 3 Dim dt As New DataTable Dim dr As DataRow Dim dv As DataView = New DataView With dt .TableName = "Result" .Columns.Add("frequency") For intLoop = 1 To 12 .Columns.Add("ch" & intLoop.ToString) Next End With With dv .Table = dt For intLoop = 1 To 10 dr = .Table.NewRow .Table.Rows.Add(dr) Next End With With Me.datResult .DataSource = dv 'In here I have a some code that enters data into the cells of my grid end with end sub End Class Public Class ColoredTextBoxColumnResult Inherits DataGridTextBoxColumn Dim passthru As PASSTHRUVARS Protected Overloads Overrides Sub Paint(ByVal graph As Graphics, _ ByVal rectbounds As Rectangle, ByVal curmngrSrc As _ CurrencyManager, ByVal RowNumber As Integer, ByVal _ ForeColorBrush As Brush, ByVal BackColorBrush As Brush, _ ByVal AlignmentRight As Boolean) Dim ObjVal As Object ObjVal = Me.GetColumnValueAtRow(curmngrSrc, RowNumber) If Not (IsNothing(ObjVal) Or IsDBNull(ObjVal)) Then If IsNumeric(ObjVal) Then Dim cellValue As Double = Convert.ToDouble(ObjVal) If cellValue = 0 Then BackColorBrush = Brushes.LightGray ForeColorBrush = Brushes.Black ElseIf (cellValue > Me.passthru.dblULVrms) Or (cellValue < Me.passthru.dblLLVrms) Then BackColorBrush = Brushes.Red ForeColorBrush = Brushes.Black Else BackColorBrush = Brushes.Gray ForeColorBrush = Brushes.Black End If Else BackColorBrush = Brushes.Gray ForeColorBrush = Brushes.Black End If Else BackColorBrush = Brushes.Gray ForeColorBrush = Brushes.Black End If ' Call Paint from the base class to ' accomplish the actual drawing. MyBase.Paint(graph, rectbounds, curmngrSrc, RowNumber, _ BackColorBrush, ForeColorBrush, AlignmentRight) End Sub End Class
-
I can show you how I check an individual cell for content and change the color and then it could give you an idea what to do from there if you like?
-
I would look into threading. This is what I use when I make a test program. here is a quick example Public Class frmHBmain Inherits System.Windows.Forms.Form dim thrdTest as thread Private Sub btnStartTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartTest.Click thrdTest = New Thread(AddressOf StartTest) thrdTest.Start() End Sub Private Sub btnStopTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStopTest.Click If thrdTest.IsAlive Then thrdTest.Abort() End Sub Private Sub StartTest 'Enter your while loop or any other code. End Sub End Class
-
Yes, without multiline, the vbNewline will only show 1 line. I am not familiar with ASP.net. Does it use the same tool as VB .NET? because is so, look in the properties area. There is a property called "ScrollBArs" and you can set that to "none".
-
here is a way in VB. Not sure what you are lookng for On Error Goto ErrorHandle 'code here exit sub ErrorHandle: messagebox.show("BLABLAH") Resume Next
-
as Gill says, and use vbNewline.
-
Oh ok, I went back and read what he was looking for a third time. I see hwta he is looing for now. Sorry, brain is a little fried. Been working on this project trying to get something to work for thepast 2 days.
-
And if you want to use the try catch method Try catch ex as exception finally ' Processes next step after handling the error end try
-
Getting the text of a selected menustrip item
techmanbd replied to bjwade62's topic in Windows Forms
Private Sub mnuHello_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHello.Click strMenuText = mnuHello.text End Sub -
It works if you don't use "NEW OBJECT" Try just "Dim a as Object" and the others as well