|
I am trying to write code for multiple if/and statements, but don’t really know how. Any help would be very much appreciated!
I need the code to loop through these statements and enter the correct information in cell M5.
IF C9= ”SHIP EXACT” AND G13<c13, then="" m5="”ENTER" remake”
if="" c9="”" no="" backorders="" on="" stock="" unless="" zero="" were="" shipped”="" and="" g13<c13,="" remake="" required”
if="" ship="" tolerance”="" g13="" c13="">10%, then M5= “ENTER REMAKE”
IF C9= ”5% Ship Tolerance” AND G13/C13>5%, then M5= “ENTER REMAKE”
|
|
|
|
|
First, phase them in your natural language, such as English:
If I score 90 and above,
then my grade is 'A'
Else If I score 80 and above (but below 90 - this one can be omitted as it would have been considered in the first if statement)
then my grade is 'B'
else If I score 70 and above
then my grade is 'C'
...
Else (last condition no need to have condition, it is understood to be none of the above)
the my grade is 'F'
Finally, print out my grade
Once you are satisfied with these statement, then translate them to vb.net code.
refer: If...Then...Else Statement (Visual Basic)[^]
|
|
|
|
|
You should use
if [condition] then
[result]
else if [condition2] then
[result2]
end if
Since when is being together a prerequisite for being in love with someone?
|
|
|
|
|
Hi guys,
i have codes that displaying different images as gif in one picturebox. My problem is, how can i save this .gif i mydocuments?
here is my codes..
thank you in advance!
Public Class Form7
Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox1.BackColor = Color.Ivory
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
TextBox1.Text = (OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
TextBox2.Text = (OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
TextBox3.Text = (OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
TextBox4.Text = (OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
TextBox5.Text = (OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
TextBox6.Text = (OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
TextBox7.Text = (OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
TextBox8.Text = (OpenFileDialog1.FileName)
End If
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Timer1.Enabled = True
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim max As Integer = 500
Dim rnd As New Random
Dim rand As Integer = rnd.Next(5, max + 1)
Dim i As Integer = 1
Dim number(max - 1) As Integer
For i = 0 To max - 1
If number(i) = rand Then
rand = rnd.Next(1, max + 1)
i = -1
ElseIf number(i) = 0 Then
number(i) = rand
rand = rnd.Next(1, max + 1)
If i = max - 1 Then
Exit For
End If
i = -1
End If
Next
Timer1.Interval = number(i)
i += 1
ChangeImage()
End Sub
Private Sub ChangeImage()
Static Dim iImage1 As Integer
Select Case iImage1
Case 0
PictureBox1.Visible = True
PictureBox1.Image = Image.FromFile(TextBox1.Text)
iImage1 += 1
Case 1
PictureBox1.Visible = True
PictureBox1.Image = Image.FromFile(TextBox2.Text)
iImage1 += 1
Case 2
PictureBox1.Visible = True
PictureBox1.Image = Image.FromFile(TextBox3.Text)
iImage1 += 1
Case 3
PictureBox1.Visible = True
PictureBox1.Image = Image.FromFile(TextBox4.Text)
iImage1 += 1
Case 4
PictureBox1.Visible = True
PictureBox1.Image = Image.FromFile(TextBox5.Text)
iImage1 += 1
Case 5
PictureBox1.Visible = True
PictureBox1.Image = Image.FromFile(TextBox6.Text)
iImage1 += 1
Case 6
PictureBox1.Visible = True
PictureBox1.Image = Image.FromFile(TextBox7.Text)
iImage1 += 1
Case 7
PictureBox1.Visible = True
PictureBox1.Image = Image.FromFile(TextBox8.Text)
iImage1 += 1
Case 8
PictureBox1.Visible = True
PictureBox1.Image = Image.FromFile(TextBox9.Text)
iImage1 += 1
Case 9
PictureBox1.Visible = True
PictureBox1.Image = Image.FromFile(TextBox10.Text)
iImage1 = 0
End Select
End Sub
End Class
modified 13-May-14 3:20am.
|
|
|
|
|
You have already asked once - please don't repost
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
on my previous post, i'm asking help for making .gif using different images in one picturebox. And to my latest post, i'm asking how can i save .gif(in picturebox) as .gif to mydocuments/computer. It's totally different although its related to ".gif"
|
|
|
|
|
You could use the following code to save a GIF image in a Picture Box(PictureBox1)
PictureBox1.Image.Save(SpecialDirectories.MyDocuments + "\MyGif.gif", ImageFormat.Gif)
Note: Import the following
System.Drawing.Imaging
Microsoft.VisualBasic.FileIO
|
|
|
|
|
Where in the above code is the part that saves the image? Please do not just dump a lot of code and expect us to work out what it is supposed to do; provide proper detailed explanation.
|
|
|
|
|
hello everyone
I need your help to achieve my MapWinGIS project Visual Basic.NET,
I wonder how to write a procedure that allows viewing the positions on the map with the symbology of my choice and displayed according to the selection in the legend group using the CheckedChanged event categories.
thank you
|
|
|
|
|
hi, will somebody give me a code in vb which will be able to receive sms using a usb gsm modem?
please help. thanks.
|
|
|
|
|
No. That's not how it works around here.
We'll help you with problems with YOUR code, but not write it for you.
You're not writing our code for us while we're writing your code for you, so...
|
|
|
|
|
'class code
Imports System.IO.Ports
Imports System.Threading
Public Class SMSCOMMS
Private WithEvents SMSPort As SerialPort
Private SMSThread As Thread
Private ReadThread As Thread
Shared _Continue As Boolean = False
Shared _ContSMS As Boolean = False
Private _Wait As Boolean = False
Shared _ReadPort As Boolean = False
Public Event Sending(ByVal Done As Boolean)
Public Event DataReceived(ByVal Message As String)
Public Sub New(ByRef COMMPORT As String)
SMSPort = New SerialPort
With SMSPort
.PortName = COMMPORT
.BaudRate = 9600
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
.Handshake = Handshake.RequestToSend
.DtrEnable = True
.RtsEnable = True
.NewLine = vbCrLf
End With
ReadThread = New Thread(AddressOf ReadPort)
End Sub
Public Sub SendSMS(ByVal CellNumber As String, ByVal SMSMessage As String)
Dim MyMessage As String = Nothing
If SMSMessage.Length <= 160 Then
MyMessage = SMSMessage
Else
MyMessage = Mid(SMSMessage, 1, 160)
End If
If IsOpen = True Then
SMSPort.WriteLine("AT")
Thread.Sleep(1000)
SMSPort.WriteLine("AT+CMGF=1" & vbCrLf) 'setting modem for sms mode
Thread.Sleep(1000)
'SMSPort.WriteLine("AT+CSCA=""+254722500059" & vbCrLf) 'setting the message service center number
SMSPort.WriteLine("AT+CMGS=""" & CellNumber & """" & vbCrLf)
Thread.Sleep(1000)
'SMSPort.WriteLine("AT+CMGS=" & CellNumber & vbCrLf)
_ContSMS = False
SMSPort.WriteLine(MyMessage & vbCrLf & Chr(26))
Thread.Sleep(1000)
_Continue = False
RaiseEvent Sending(False)
'MessageBox.Show("Successfully sent")
End If
End Sub
Private Sub ReadPort()
Dim SerialIn As String = Nothing
Dim RXBuffer(SMSPort.ReadBufferSize) As Byte
Dim SMSMessage As String = Nothing
Dim Strpos As Integer = 0
Dim TmpStr As String = Nothing
Try
Catch ex As Exception
While SMSPort.IsOpen = True
If (SMSPort.BytesToRead <> 0) And (
SMSPort.IsOpen = True) Then
While SMSPort.BytesToRead <> 0
SMSPort.Read(RXBuffer, 0, SMSPort.ReadBufferSize)
SerialIn =
SerialIn & System.Text.Encoding.ASCII.GetString(
RXBuffer)
If SerialIn.Contains(">") = True Then
_ContSMS = True
End If
If SerialIn.Contains("+CMGS:") = True Then
_Continue = True
RaiseEvent Sending(True)
_Wait = False
SerialIn = String.Empty
ReDim RXBuffer(SMSPort.ReadBufferSize)
End If
End While
RaiseEvent DataReceived(SerialIn)
SerialIn = String.Empty
ReDim RXBuffer(SMSPort.ReadBufferSize)
End If
End While
End Try
End Sub
Public ReadOnly Property IsOpen() As Boolean
Get
If SMSPort.IsOpen = True Then
IsOpen = True
Else
IsOpen = False
End If
End Get
End Property
Public Sub Open()
If IsOpen = False Then
SMSPort.Open()
ReadThread.Start()
End If
End Sub
Public Sub Close()
If IsOpen = True Then
SMSPort.Close()
End If
End Sub
End Class
'window form
'Form Code
Imports System
Imports System.Threading
Imports System.ComponentModel
Imports System.IO.Ports
Imports mordemsms.SMSCOMMS
Public Class Form1
Private Sub sendbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sendbtn.Click
Dim sms As SMSCOMMS
sms = New SMSCOMMS("COM12")
sms.Open()
sms.SendSMS(TextBox1.Text, TextBox2.Text)
sms.Close()
End Sub
End Class
ok. this is the code i have written to receive an sms. i want to add the function to receive a sms on the same modem. i am unable to go on. somebody help please.
|
|
|
|
|
Hello !
I'm using Entity framework 6 with Sql server 2008r2.
But I have noticed that even a small query ( with only 2-3 records ) need about 25 seconds to execute.
This happens everytime when I execute a query for the first time.The second time is more fast. But if I open another form and execute another query , there's again a delay.
what can I do ?
Thank you !
|
|
|
|
|
This was a problem with EF 6.0 that has been fixed in the latest update, I believe it is 6.0.2 that fixes it.
Open the Package Manager console in your project and type
Update-Package EntityFramework
|
|
|
|
|
Hello !
I have update it , but it's the same situation.
|
|
|
|
|
In that case I have idea what it is.
|
|
|
|
|
Hello !
I thought to use Pre-Generated views.
I have installed "Interactive Pre-Generated Views for Entity Framework 6 "
- On Console Manager : install-package EFInteractiveViews
- On my main form I have this :
Imports InteractivePreGeneratedViews
Private Sub IntViews()
Using ctx = New MyEntities()
InteractiveViews.SetViewCacheFactory(ctx,NewFileViewCacheFactory("C:\Myprog\MyViews.xml"))
End Using
End Sub
Now I get 2 errors :
Error 104 :
Error 105 : Type
What can I do ?
Thank you !
|
|
|
|
|
I have no idea. I've never used that.
I'm still on EF5.
|
|
|
|
|
|
Hello everyone,
I want to create a text file when a program loads for the first time and refer it every time when we load the form or activate the form.
Open "C:\" & "filename.txt" For Output As #1
register = CStr(Date)
Print #1, register
Close #1
This sample code is working on Win XP but its not creating txt file in Win 7. Please let me know how to make them work in 7 or 8 as well. Thanks in advance.
|
|
|
|
|
reason for it not working on Win7 is UAC[^].
it is suggested that you then look at writing files into the app data folder of the user.
The first answer from this link[^] gives you a good example of how to do it
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
|
how can i develop 8-puzzle game in order to work automatically rather than manually? by using vb6.
mpk
|
|
|
|
|
You can start by reading this post![^]
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Why would you START a development in a tool that has been dead for a DECADE. Get the Express version of VB.Net.
Never underestimate the power of human stupidity
RAH
|
|
|
|