|
I found some snippets and tweaked them for my use. Sort of Linq, hard part was forming the expression without a reference.
I ended up dumping the first idea and went back to a DataView to grab my rows as a table, and them summed them up.
Calculate Sum (Total) of DataTable Columns using C# and VB.Net[^]
Dim dv_top10 As New DataView(table_Active)
dv_top10.Sort = "Y1_ATD Desc"
Dim dt_top10 = dv_top10.ToTable().Rows.Cast(Of DataRow)().Take(10)
Dim T10 As Decimal = dt_top10.AsEnumerable().Sum(Function(row) row.Field(Of Decimal)("Y1_ATD"))
|
|
|
|
|
jkirkerx wrote: without a reference
A string that contains the column name followed by "ASC" (ascending) or "DESC" (descending).
Columns are sorted ascending by default.
Multiple columns can be separated by commas.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Reference to a class
.Sum(function(m) m.Y1_ATD) vs .Sum(Function(row) row.Field(Of Decimal)("Y1_ATD"))
Sort of writing a manual type, in which I didn't know you can do.
|
|
|
|
|
I'm gonna revisit my packaging algorithm soon. I haven't been able to work on that project for over 3 weeks now. Maybe I'll try Just Answers and pay someone for help on that.
|
|
|
|
|
I'm trying to sort a dataset, because I can't do it in SQL, the Order By would have to be a join and sum of invoices from a data range.
I have this code that I wrote, but it doesn't sort. Am I on the right track here?
I tried sorting on the DataTable before adding it to the dataset but was not successful.
Maybe I'm suppose to get the DataView back to the set.
This is my time doing this and I have no clue.
Dim table_Active As DataTable = New DataTable()
table_Active.TableName = "dt_customerActive"
table_Active.Columns.Add(New DataColumn("ID", System.Type.GetType("System.String")))
Dim ds_Active As DataSet = New DataSet()
ds_Active.DataSetName = "ds_customerActive"
ds_Active.Tables.Clear()
ds_Active.Tables.Add(table_Active)
ds_Active.Tables(0).TableName = "tablix_salesActive"
Dim dV As DataView = New DataView(ds_Active.Tables("tablix_salesActive"))
Select Case p_sortOrder
Case salesHistory5Year_Sort.Name
dV.Sort = "Name"
Case salesHistory5Year_Sort.Spent
dV.Sort = "TATD DESC"
Case salesHistory5Year_Sort.Territory
dV.Sort = "Territory"
End Select
|
|
|
|
|
I sorted the table, didn't know about the .ToTable to assign to the Dataset.
Dim dV As DataView = New DataView(table_Active)
Select Case p_sortOrder
Case salesHistory5Year_Sort.Name
dV.Sort = "Name"
Case salesHistory5Year_Sort.Spent
dV.Sort = "TATD DESC"
Case salesHistory5Year_Sort.Territory
dV.Sort = "Territory"
End Select
Dim ds_Active As DataSet = New DataSet()
ds_Active.DataSetName = "ds_customerActive"
ds_Active.Tables.Clear()
ds_Active.Tables.Add(dV.ToTable())
ds_Active.Tables(0).TableName = "tablix_salesActive"
|
|
|
|
|
Hi,
how would the following C++ pointer use be translated into VB.NET?
Dim p As Byte * = pDataBegin
*p = (*p) Xor nOut
Anyone can help?
SepPax
|
|
|
|
|
|
Probably something like:
Dim myByteArray = New Byte(){1, 2, 3}
For index = 0 To myByteArray.GetUpperBound(0)
myByteArray(index) = myByteArray(index) Xor nOut
Next
Or slightly simpler
For Each element In myByteArray
element = element Xor nOut
Next
modified 30-Aug-16 10:44am.
|
|
|
|
|
How create a program of usb write protected in visual studio can any one help me with a source code?
|
|
|
|
|
This site does not provide code to order.
We're happy to help with specific questions about code you have written. But nobody here is going to do your work for you.
And quite frankly, even if you were paying someone to do your work for you, you wouldn't get very far with a description as vague as that!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Member 12705131 wrote: can any one help me with a source code? Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
can any one help me with neural network simulator source code in visual basic or link where i can get it. thanks
|
|
|
|
|
|
If you're looking for source code, you're really not going to find a good example you can tailor to your needs. This is something you HAVE to understand and write yourself.
You're be better served looking for tutorials and reading books on the concepts. I suggest Googling for "Neural network tutorials" to get an introduction.
|
|
|
|
|
I am trying to resize a selected image in Word vba and then move it to the RHS of the page.
The resizing works fine and the image is then converted into a shape. I'm then not sure how to replace the two lines of code
Set ils = ActiveDocument.InlineShapes(1)
Set shp = ils.ConvertToShape
to continue with the last part of the code and move the image to the RHS of the page.
Full code is as follows
Sub PicResizeMoveToRight()
Dim ils As InlineShape
Dim shp As Shape
Dim PercentSize As Integer
PercentSize = InputBox("Enter percent of full size", _
"Resize Picture", 100)
If Selection.InlineShapes.Count > 0 Then
Selection.InlineShapes(1).ScaleHeight = PercentSize
Selection.InlineShapes(1).ScaleWidth = PercentSize
End If
Set ils = ActiveDocument.InlineShapes(1)
Set shp = ils.ConvertToShape
With shp
.WrapFormat.Type = wdWrapTight
.RelativeVerticalPosition = wdRelativeVerticalPositionMargin
.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
.Left = wdFrameRight
End With
End Sub
Any help would be appreciated thanks
|
|
|
|
|
Why are you switching between modifying the first selected shape, and modifying the first shape in the document?
I'd expect to see something more like this:
If Selection.InlineShapes.Count = 0 Then
MsgBox "Please select a shape!"
Exit Sub
End If
Set ils = Selection.InlineShapes(1)
PercentSize = InputBox("Enter percent of full size", "Resize Picture", 100)
ils.ScaleHeight = PercentSize
ils.ScaleWidth = PercentSize
Set shp = ils.ConvertToShape
...
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Many thanks Richard - just what i needed.
I wasn't sure how to do the second part with the already selected shape.
My final code is now
Sub PicResizeMoveToRight()
Dim ils As InlineShape
Dim shp As Shape
Dim PercentSize As Integer
If Selection.InlineShapes.Count = 0 Then
MsgBox "Please select a shape!"
Exit Sub
End If
Set ils = Selection.InlineShapes(1)
PercentSize = InputBox("Enter percent of full size", _
"Resize Picture", 100)
ils.ScaleHeight = PercentSize
ils.ScaleWidth = PercentSize
Set shp = ils.ConvertToShape
With shp
.WrapFormat.Type = wdWrapTight
.RelativeVerticalPosition = wdRelativeVerticalPositionMargin
.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
.Left = wdFrameRight
End With
End Sub
|
|
|
|
|
Dear all,
I made a program to send email using SMTP for gmail or yahoo, but when I try to make the settings for company mail it is failed. Taking in to consideration the I have the settings that I connect my email to MS Outlook (Server Setting, MS Exchange Proxy server)
If anyone can help me I will appreciate him.
Regards,
Taher Hamdy
|
|
|
|
|
MS Exchange needs to be configured for SMTP and POP3 - that is not active by default.
If your program still fails, show us the code and the exact error message.
|
|
|
|
|
Thanks Bernhard,
the code as below
Imports System.Net.Mail
Imports System.Net
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = "Taher Shaker Mailer"
End Sub
Private Sub BtnSend_Click(sender As Object, e As EventArgs) Handles BtnSend.Click
Dim MyMessage As New MailMessage()
MyMessage.From = New MailAddress("myemail@company.com")
MyMessage.To.Add("another@gmail.com")
MyMessage.Subject = "my subject"
MyMessage.Body = "my message body"
Dim MyNetworkCredential As New NetworkCredential
MyNetworkCredential.Domain = "companyserver.com"
MyNetworkCredential.UserName = "myusername"
MyNetworkCredential.Password = "mypassword"
Try
Dim MySmtpClient As New SmtpClient()
MySmtpClient.Host = "https://companyserver.com"
MySmtpClient.Credentials = MyNetworkCredential
MySmtpClient.Send(MyMessage)
Catch ex As SmtpException
MessageBox.Show(ex.ToString)
Exit Sub
End Try
End Sub
also the error as below:
System.net.mail.smtpException: Failure sending mail
|
|
|
|
|
|
In a vb.net 2010 application, I have just written the following code where data is obtained from the database and stored in the dataset called _dtreasonsnonattendance.
dim String columnname
For i = 0 To _dtreasonsnonattendance.Rows.Count() - 1
columnname = _dtreasonsnonattendance.Rows(i)(_dtreasonsnonattendance.Columns(7).ColumnName()).ToString()
next
In the part of the statement listed above, when I hover over the 'ColumnName()' part of the statement listed above, I see the actual column name. I want the assignment statement to actually obtain the column name. Thus would you show me the code on how I can accomplish my goal?
|
|
|
|
|
Ignoring the fact that your code won't even compile, from the description you just want:
Dim columnName As String = _dtreasonsnonattendance.Columns(7).ColumnName
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|