|
Is that supposed to be a question or a statement?
|
|
|
|
|
Please google: "excel maximum cell text length"
My advice is free, and you may get what you paid for.
|
|
|
|
|
hi there.
im creating a label sequencer for 3 produts and i'm trying this but with no success
sql_query.CommandText = "insert into tablelabel02 with (tablockx) (nome_posto, ordemfabrico, serialnumber, referencia,dataetiqueta,qrgerado,data,operador,posx,posy,impressora,controlo)output inserted.qrgerado
values (@posto, @ordemfabrico, next value for '" & sequenceID & "' , @refcode, replace(cast(convert(varchar,getdate(),5) as varchar(10)),'-','/'),
@refcode+replace(cast(convert(varchar,getdate(),5)as varchar(10)),'-','')+right('000'+cast((next value for '" & sequenceID & "' )as varchar (4)),4), getdate(), @operador,@labelx,@labely, @impressora, 'xx' );"
for each product i have created a sequence in ms sql, so when i inserted the production order number, i can sort what sequencer to use but i cant use it as sequenceID variable.
i tried
next value for seq_a and it works.
with
next value for '" & sequenceID & "' not working
in resume:
i want to use next value for @variable if possible
|
|
|
|
|
Can you define not working? It will be helpful if you can share the error message.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
I wanted to use next value for X where x is a variable and not have to put the name of the sequence table
|
|
|
|
|
Currently I have this:
Private Sub btnCount_Click(sender As Object, e As EventArgs) Handles btnCount.Click
Dim arrsize = rtbDHCP_lease.Lines.Length - 1
Dim MyNum(arrsize)
For I = 1 To arrsize
MyNum(I) = rtbDHCP_lease.Lines(I).Substring(41, (rtbDHCP_lease.Lines(I).IndexOf(".", 41) - 41))
ProgressBar1.Value = (I / arrsize) * 100
Next
Dim query = From item In MyNum
Order By item
Group By vlans = item
Into vlans_count = Group, Count()
For Each result In query
dgvDHCPcount.Rows.Add(New Integer() {result.vlans, result.Count})
Next
End Sub
It takes a long time to go through the richtextbox especially if it has a large amount of lines. Is there a process the can speed it up?
Thanks in advance.
|
|
|
|
|
First question.
Why are you using a RTB as a data storage structure? That text should be parsed to grab the data out of the text file itself and not from the RTB.
The mistake most people new to writing code in a GUI environment is treating visual controls as workable containers for data structures and data storage. That's not what they are for and will only make parsing and working with the data much, much slower.
So where did the data you put in the RTB come from?
|
|
|
|
|
I am a vb6 developper and when I install my apps they look different, sometimes with larger windows some other times smaller windows. So, how can I work with form properties so that they look the same?
Kind regards,
Alexis
|
|
|
|
|
You have to resize controls and forms relative to the screen size. It's a pain.
Alternatively, see my comment below about using VB.Net instead - then a lot of the pain is taken away with standard properties.
|
|
|
|
|
Quote: I am a vb6 developper
I hate to tell you this, but your skill set is just about completely worthless. VB6 has been dead for quite a long time.
If you're asking this question, it suggests you haven't been writing VB6 code for that long. I would suggest dropping it in favor of at least VB.NET. The Community edition of VIsual Studio is free from here[^].
If you continue down the VB6 road, you'll end up with a skill set that's not being used at all and VB6 will teach you very bad habits you're going to have to unlearn to do things correctly in the modern world.
|
|
|
|
|
UWP apps (windows 10) looks good on all screens; with no tweaking.
Using the control panel's "Ease of Access", you can change the text size, if necessary. That's about all that's ever needed.
The "simulator" lets you run at various screen resolutions to see.
Apps can be "side-loaded" without using the MS Store for distribution.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hey guys,
I ve been having a problem with components while installing any app that I ve developped in vb6. Now, I want to include my downloded .ocx and .dll in the folder with other when I make my setup but I still have a problem of components registration. I am still forced to register the components manually. Is there any way the setup can register automatically the components like other apps?
Thanks
|
|
|
|
|
You do know that VB6 has been out of support for decades now?
And that it needs to be registered using the 32-bit version of regsvr32.exe?
You will need to explicitly give the full path to SysWOW64\regsvr32.exe.
You will need to make sure all of the associated dll's etc for VB6 Runtime are also installed - if your version of Windows still supports them.
Better option - get a more recent copy of Visual Studio and rewrite your application in VB.net - it's free, unlike VB6
|
|
|
|
|
Just seen the original post and the only, completely useless reply. In my opinion and experience, the best free installer can be found here: Inno Setup[^]
I have used the software with great success in any number of situations and for many different products. It just requires a bit of reading of the very extensive documentation. Help is readily available.
Hope you find this answers your question and needs.
|
|
|
|
|
hi every one i have this code to generate a sequential serial number.
and have another private sub to retrive the last inserted serial number
is it possible to do that in this one?
<pre> Private Sub Gera2d()
Try
data = DateAndTime.Now
Dim con As New SqlConnection
Dim sql_query As New SqlCommand
Dim sql_result As SqlDataReader
con.ConnectionString = "server='" & SqlServer & "';Database=etiquetasKLC;Uid='" & SqlUser & "';PWD='" & Sqlpassword & "';"
sql_query.Connection = con
con.Open()
sql_query.Parameters.Add("@posto", SqlDbType.NVarChar).Value = posto
sql_query.Parameters.Add("@data", SqlDbType.NVarChar).Value = data
sql_query.Parameters.Add("@lote", SqlDbType.NVarChar).Value = ordemFabrico
sql_query.Parameters.Add("@versao", SqlDbType.NVarChar).Value = status
sql_query.Parameters.Add("@indexnumber", SqlDbType.NVarChar).Value = cavidade + indexnumber
sql_query.Parameters.Add("@semana", SqlDbType.NVarChar).Value = weekyear
sql_query.Parameters.Add("@qrgerado", SqlDbType.NVarChar).Value = codigoQr
sql_query.Parameters.Add("@operador", SqlDbType.NVarChar).Value = op
sql_query.Parameters.Add("@partnumber", SqlDbType.NVarChar).Value = partnumber
sql_query.Parameters.Add("posx", SqlDbType.NVarChar).Value = labelx
sql_query.Parameters.Add("posy", SqlDbType.NVarChar).Value = labely
sql_query.Parameters.Add("ip_impressora", SqlDbType.NVarChar).Value = enderecoimpressora
sql_query.CommandText = "INSERT INTO etiquetas with (tablockx)(nome_posto, data, lote, serialnumber,partnumber,versao,indexnumber,semana, qrgerado,operador,snpn,posx,posy,impressora) select top (1) @posto,
@data,@lote,T.x,@partnumber,@versao, @indexnumber,@semana, T.x+@partnumber+@versao+@indexnumber+@semana, @operador, T.x+@partnumber, @posx,@posy,@ip_impressora
FROM [etiquetas] x CROSS APPLY (VALUES(format(convert(int,x.serialnumber)+1,'0000000')))T(x) where partnumber like @partnumber order by id desc ;"
sql_query.Parameters.AddWithValue("@sn", serialnumber)
serialnumber = sql_query.ExecuteScalar()
Try
If sql_query.ExecuteScalar() <> 0 Then
serialnumber = serialnumber
End If
Catch ex As Exception
IO.File.AppendAllText("C:\ti\Log.txt", String.Format("{0}{1}", Environment.NewLine, Now() + " - " + ex.ToString()))
End Try
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
modified 17-Dec-19 11:12am.
|
|
|
|
|
SQL does auto increment on identity columns so perhaps make use of that. As for your question, the answer is yes. Just call that method here.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
Member 14668666 wrote:
serialnumber = sql_query.ExecuteScalar()
Try
If sql_query.ExecuteScalar() <> 0 Then NB: You're executing the INSERT query twice every time you call this method.
Also, ExecuteScalar won't have anything to return, since your query doesn't return any records.
Add an OUTPUT clause[^] to your query:
sql_query.CommandText = "INSERT INTO etiquetas WITH (tablockx) (nome_posto, data, lote, serialnumber, partnumber, versao, indexnumber, semana, qrgerado, operador, snpn, posx, posy, impressora) OUTPUT inserted.serialnumber SELECT TOP (1) @posto, @data, @lote, T.x, @partnumber, @versao, @indexnumber, @semana, T.x + @partnumber + @versao + @indexnumber + @semana, @operador, T.x + @partnumber, @posx, @posy, @ip_impressora FROM [etiquetas] x CROSS APPLY (VALUES(format(convert(int, x.serialnumber) + 1, '0000000'))) T(x) WHERE partnumber LIKE @partnumber ORDER BY id DESC;" Remove the @sn parameter, since it's not used in the query.
Change your code so that it only executes the query once.
Try
serialnumber = sql_query.ExecuteScalar()
Catch ex As Exception
IO.File.AppendAllText("C:\ti\Log.txt", String.Format("{0}{1}", Environment.NewLine, Now() + " - " + ex.ToString()))
End Try
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thanks a lot.
it work like charm
|
|
|
|
|
Richard Deeming wrote: Also, ExecuteScalar won't have anything to return, since your query doesn't return any records.
ExecuteNonQuery would be more appropriate for inserts and delete's
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Ms Chart is a pain in the behind, first I had an issue where when binding or manually adding dates to my X axis it would force add every single date in between even though that data didn't exist, my SQL code is setup with a date dimension table which makes it so I only return exactly the number of rows I want (4 weeks 4 values, 5 months, 5 values)
"Fixed" that by instead adding generic counter for X axis and then setting the label to the date, or so I thought...
[Now that I've added code to do multiple series the damn thing is adding extra items to the X axis again]
[The dates in each series are exactly the same.]
My counter gets reset to 0 before every series and when I loop through the code to see the data points in debug the labels and data are set properly for every series. but ms chart still decides it needs 12 billion extra lines on the X axis for no goddamn explainable reason.
Private Sub LoadChart()
Dim oDT As New DataTable
Dim sqlCmd As New SqlCommand
Dim sSQLDateCTE As String = "WITH Date_CTE as ( " & _
"SELECT {0} DDim.[Date] as SaleDate " & _
"FROM [DateDimension] as DDim {1} "
Dim sWHEREDateCTE As String = "WHERE [Date] BETWEEN DATEADD({0},-{1},GETDATE()) AND GETDATE() {2} "
Dim sSQLSUM As String = "), SUM_CTE as ( " & _
"SELECT {0}" & _
"FROM {1} " & _
"WHERE F1034 = 3 AND F64 <> 0 AND F01 = @UPCCode " & _
"AND F254 IN (SELECT saledate FROM Date_CTE) " & _
"GROUP BY {2}) "
Dim sSQLFinalPart = "SELECT {0} DC.SaleDate ,ISNULL(SC.UnitsSold,0) as UnitsSold " & _
"FROM Date_CTE as DC " & _
"LEFT OUTER JOIN SUM_CTE as SC " & _
"ON SC.SaleDate = DC.SaleDate {1}" & _
"ORDER BY DC.SaleDate ASC "
Dim sFieldList As String = ""
Dim sGroupBy As String = ""
Dim sStorelist As String = ""
Dim sWhereIN As String = ""
Dim sWhereINDateCTE As String = ""
Dim sSQL As String = ""
Try
If oAppEnv.sSource = "H" Then
For Each CheckedItem In clbStores.CheckedItems
If sStorelist <> "" Then
sStorelist = sStorelist & ", "
End If
sStorelist = sStorelist & CheckedItem.key
Next
End If
If sStorelist <> "" Then
sFieldList = "F01 as UPCCode, F1056 as Store, F254 as SaleDate, SUM(F64) as UnitsSold "
sGroupBy = "F01,F1056,F254"
sSQLDateCTE = String.Format(sSQLDateCTE, "SL.Store, ", "CROSS JOIN Newbuck.dbo.tblStoreList as SL ")
sWhereIN = "AND {0} in ({1}) "
sWhereINDateCTE = String.Format(sWhereIN, "SL.Store", sStorelist)
sSQLFinalPart = String.Format(sSQLFinalPart, "DC.Store, ", "AND SC.Store = DC.Store ")
Else
sFieldList = "F01 as UPCCode, F254 as SaleDate, SUM(F64) as UnitsSold "
sGroupBy = "F01,F254"
sSQLDateCTE = String.Format(sSQLDateCTE, "", "")
sWhereINDateCTE = ""
sSQLFinalPart = String.Format(sSQLFinalPart, "", "")
End If
Dim PeriodRow As DataRow = oAppEnv.dtPeriods.Select(String.Format("DPPeriodID = {0}", cboPeriods.SelectedValue)).FirstOrDefault
Dim DurationRow As DataRow = oAppEnv.dtDurations.Select(String.Format("DDDurationID = '{0}'", cboDuration.SelectedValue)).FirstOrDefault
Select Case PeriodRow.Item("DPPeriodAbbrev")
Case "D"
sWHEREDateCTE = String.Format(sWHEREDateCTE, "DD", DurationRow.Item("DDDurationLength"), sWhereINDateCTE)
sSQLSUM = String.Format(sSQLSUM, sFieldList, "RPT_ITM_D", sGroupBy)
sSQL = sSQLDateCTE & sWHEREDateCTE & sSQLSUM & sSQLFinalPart
Case "W"
sWHEREDateCTE = String.Format(sWHEREDateCTE, "WW", DurationRow.Item("DDDurationLength"), sWhereINDateCTE) & " AND Weekday = 1 "
sSQLSUM = String.Format(sSQLSUM, sFieldList, "RPT_ITM_W", sGroupBy)
sSQL = sSQLDateCTE & sWHEREDateCTE & sSQLSUM & sSQLFinalPart
Case "M"
sWHEREDateCTE = String.Format(sWHEREDateCTE, "MM", DurationRow.Item("DDDurationLength"), sWhereINDateCTE) & " AND [DAY] = DATEPART(Day,getdate()) "
sSQLSUM = String.Format(sSQLSUM, sFieldList, "RPT_ITM_M", sGroupBy)
sSQL = sSQLDateCTE & sWHEREDateCTE & sSQLSUM & sSQLFinalPart
Case "Y"
sWHEREDateCTE = String.Format("WHERE [Date] BETWEEN '01-01-2009' AND GETDATE() AND DayOfYear = 1 {0} ", sWhereINDateCTE)
sSQLSUM = String.Format(sSQLSUM, sFieldList, "RPT_ITM_Y", sGroupBy)
sSQL = sSQLDateCTE & sWHEREDateCTE & sSQLSUM & sSQLFinalPart
End Select
sqlCmd.CommandText = sSQL
sqlCmd.Parameters.AddWithValue("@UPCCode", sUPCCode)
oDT = oAppEnv.oLogiDM.GetSQLData(sqlCmd)
ctSalesData.ChartAreas.Clear()
ctSalesData.ChartAreas.Add("Sales")
ctSalesData.Series.Clear()
If oDT IsNot Nothing Then
'//Get the Date range.
Dim oSortDV As DataView = oDT.DefaultView
oSortDV.Sort = "UnitsSold DESC"
'ctSalesData.DataSource = oDT
Dim iCnt As Integer = 0
ctSalesData.AlignDataPointsByAxisLabel()
If oAppEnv.sSource = "H" And sStorelist <> "" Then
For Each CheckedItem In clbStores.CheckedItems
Dim oStoreRows() As DataRow = oDT.Select("Store = " & CheckedItem.key)
iCnt = 0
Dim cSeries As New Charting.Series(CheckedItem.key)
cSeries.ChartType = Charting.SeriesChartType.Bar
cSeries.IsXValueIndexed = True
cSeries.CustomProperties = "PixelPointWidth = 20"
cSeries.IsValueShownAsLabel = True
For Each row In oStoreRows
cSeries.Points.AddXY(iCnt, row.Item("UnitsSold"))
cSeries.Points(iCnt).AxisLabel = row.Item("SaleDate")
iCnt += 1
Next
ctSalesData.Series.Add(cSeries)
Next
Else
Dim cSeries As New Charting.Series("Sales")
cSeries.ChartType = Charting.SeriesChartType.Bar
cSeries.IsXValueIndexed = True
cSeries.CustomProperties = "PixelPointWidth = 15"
cSeries.IsValueShownAsLabel = True
For Each row In oDT.Rows
cSeries.Points.AddXY(iCnt, row.item("UnitsSold"))
cSeries.Points(iCnt).AxisLabel = row.item("SaleDate")
iCnt += 1
Next
ctSalesData.Series.Add(cSeries)
End If
ctSalesData.ChartAreas(0).AxisX.Minimum = 0
ctSalesData.ChartAreas(0).AxisX.Maximum = oDT.Rows.Count + 1
If oDT.Rows.Count > 21 Then
Dim ZoomDate As Date = oDT.Rows(14).Item("SaleDate")
ctSalesData.ChartAreas(0).AxisX.ScaleView.Zoom(0, 22)
End If
ctSalesData.ChartAreas(0).AxisX.Interval = 1
ctSalesData.ChartAreas(0).AxisY.Minimum = 0
ctSalesData.ChartAreas(0).AxisY.Interval = 1
ctSalesData.ChartAreas(0).AxisY.Maximum = Math.Ceiling(oSortDV(0).Item("UnitsSold") / 10) * 10
If ctSalesData.ChartAreas(0).AxisY.Maximum = oSortDV(0).Item("UnitsSold") Then
ctSalesData.ChartAreas(0).AxisY.Maximum += 10
End If
ctSalesData.ChartAreas(0).CursorX.AutoScroll = True
ctSalesData.ChartAreas(0).AxisX.ScaleView.SizeType = Charting.DateTimeIntervalType.Number
ctSalesData.ChartAreas(0).AxisX.ScrollBar.ButtonStyle = Charting.ScrollBarButtonStyles.SmallScroll
ctSalesData.ChartAreas(0).AxisX.ScaleView.SmallScrollSize = 21
ctSalesData.ChartAreas(0).AxisX.ScrollBar.IsPositionedInside = False
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
|
|
|
|
|
I think I found the answer by walking the Parent of Msg.HWnd until I find the containing 'Control' window in which FromHandle(hwnd) returns a Control object.
In a custom control I have implemented an IMessageFilter to process the WM_MOUSEMOVE message to determine when the mouse is over a particular control.
I then try to convert the hWnd to a control with Control.FromHandle(Msg.HWnd). This works for common controls.
When the mouse is over as WebBrowser control I get Nothing returned from FromHandle().
I can use api GetClassName() to get the class name which returns either "shell embedding" or "internet explorer_server".
The problem is I have more than one WebBrowser instance in the app. and need to distinguish between them.
My question is, is there some value I can retrieve using an api with Msg.HWnd that will be unique to the particular instance object?
WebBrowser does not have a Text property so GetWindowText() returns "".
WebBrowser does have a Tag and Name property but I don't know if that is accessable through a windows api.
Thank you
-- modified 25-Nov-19 10:39am.
|
|
|
|
|
|
This has nothing to do with Visual Basic. The answer is most likely in the manual that came with your router.
|
|
|
|
|
Need help...
Table Name - cashbook
Field name - pname & amount
Examble
pname amount
Antony 1500
Jose 3000
Antony 3500
need to display in msflexgrid like belo
Antony - 5000
Jose - 3000
below my code is not working....can anybody help me
Rec.open "select from pname,sum(amount) as amt from cashbook group by pname order by pname,var,adopendynamic,adlockoptimist
While rec.eof=false
Pymnt.rows=pymnt.rows+1
Pymnt.textmatrix(pymnt.rows -1,0)=rec!pname
Pymnt.textmatrix(pymnt.rows -1,1)=amt
Rec.movenext
Wend
Rec.close
|
|
|
|
|
Read your SELECT statement again. An SQL SELECT is of the form
SELECT <fieldlist>
FROM <table>
WHERE condition
GROUP BY <<fieldlist>
ORDER BY <fieldlist>
You have a FROM where it does not belong.
SELECT FROM <fieldlist>
FROM cashbook
GROUP BY pname
ORDER BY pname
And you might want to get off of VB6. It's been dead for quite a long time now and getting into VB.NET development is free!
|
|
|
|
|