Grin
Grin
CC#
Created by Grin on 8/3/2023 in #help
❔ How can I connect to an API?
I recently created a Xamarin app for android that I want to connect to a server (this app will never be available to the public, its for learning purposes about servers & api only). But I have found that the connection times out a lot. I've noticed that a WinForms app I created connects to my server no problem, the connection is fast and the information is loaded in less than a second. Is it possible to make my Xamarin app connect to a WinForms app (I think that would make the Winforms app an api?) that connects to the server, grabs information the user requested, and send it back to the Xamarin app?
28 replies
CC#
Created by Grin on 7/18/2023 in #help
✅ What knowledge base is necessary to create a winforms app that communicates with a server?
I'm trying to create a simple Winforms app to better understand how communications with servers work, but I've never worked with sql or online servers. I'd like to create a small winforms app with 8 checkboxes that communicate with an online server. I'd like for the server to have 8 boolean values that can be changed on my winforms app after the app fetches the boolean values from the server. What knowledge base do I need to do this besides c#? Where should I start to learn about setting up my own server for online use for the app?
5 replies
CC#
Created by Grin on 7/3/2023 in #help
❔ IDE error when trying to debug
37 replies
CC#
Created by Grin on 6/30/2023 in #help
✅ Xamarin debugging issues
While attempting to debug the function for a side bar I get a pop up box stating "No compatible code running on the thread." I know that I have c# code functioning properly within this body but I can't debug the content within it for some reason?
public bool OnNavigationItemSelected(IMenuItem item)
{
//There is content in here, I just can't fit it all in this discord page.
}
public bool OnNavigationItemSelected(IMenuItem item)
{
//There is content in here, I just can't fit it all in this discord page.
}
5 replies
CC#
Created by Grin on 6/27/2023 in #help
❔ Requesting guidance on what & where to learn for potential project
First my app idea: I'm creating an android app that keeps track of checkpoints for racers. The app has 10 check boxes. Every time a racer reaches a check point they'll tick off the check box they've reached and move unto the next one (honor system for now). This app can be used by as many racers whom want to participate, and of course the race occurs simultaneously so everyone will be checking off boxes at similar times. I'd like this app to be able to communicate with other apps, showing other racers progress (by showing which check boxes have been ticked) as well as an official boss app tracker to keep track of all progress. Language I'm using/KnowSoFar: I'm writing this code in Xamarin (xml, c#) but I don't think the communications between servers or apps can occur within Xamarin? I've never made an app that communicates with other apps or servers. The crux of my question is this: where can I learn about communications between apps & servers where I can incorporate that knowledge into functioning code that communicates with my app or where my app sends information to a server & all apps communicate with a server? I primarily code in c#, and have some knowledge in c++ if that matters.
25 replies
CC#
Created by Grin on 5/29/2023 in #help
✅ How can I create a scroll event? I can't find any "scroll" events
I'm trying to find an event to check if the user scrolls through a listbox_Names. I want to set the other list boxes to the same value so everything is kind of symetrical.
12 replies
CC#
Created by Grin on 12/7/2022 in #help
✅ How do I load an earlier version of my code from github?
Yesterday I finished a small update on a project I was working on. I created a repository and pushed everything then saved. Today I opened up studio & changed quite a bit of stuff and actually broke my program. I want to load back to yesterdays version but I accidently saved the project on my computer (local) without pushing. Besides going to my github and just copy/pasting everything, is there a way for me to pull the old version without having conflicts from github? I've never used the pull or fetch function before.
3 replies
CC#
Created by Grin on 12/1/2022 in #help
✅ Whenever I read from a file, do I need to close the file if I want to read from it again?
I want to read from a file to get the number of names within the file so I can create an array with a correct number of elements. I'm wondering if it's okay for me to not close the file before determining that number of names.
// Open the file and get a StreamReader object.
inputFile = File.OpenText("D:\\Projects\\Chapter7\\Ch7-BinarySearch\\Ch7-BinarySearch\\Names.txt");

//getting the total number of names within the file
while (!inputFile.EndOfStream)
index++;

//do I need to close the file and reopen it to prevent an error in the next while loop here?

// While we're not at the end of the array and not at the end of the file, Read the file's contents into the array.

int counter = 0;
while (counter < index && !inputFile.EndOfStream)
{
namesArray[counter] = inputFile.ReadLine();
counter++;
}

// Close the file.
inputFile.Close();
// Open the file and get a StreamReader object.
inputFile = File.OpenText("D:\\Projects\\Chapter7\\Ch7-BinarySearch\\Ch7-BinarySearch\\Names.txt");

//getting the total number of names within the file
while (!inputFile.EndOfStream)
index++;

//do I need to close the file and reopen it to prevent an error in the next while loop here?

// While we're not at the end of the array and not at the end of the file, Read the file's contents into the array.

int counter = 0;
while (counter < index && !inputFile.EndOfStream)
{
namesArray[counter] = inputFile.ReadLine();
counter++;
}

// Close the file.
inputFile.Close();
20 replies
CC#
Created by Grin on 12/1/2022 in #help
✅ I'm having trouble understanding what is going on within this selection search
// The SelectionSort method accepts a string array as an argument.
// It uses the Selection Sort algorithm to sort the array.
private void SelectionSort(string[] sArray)
{

int minIndex; // Subscript of minimum value in scanned area
string minValue; // Minimum value in the scanned area

// The outer loop steps through all the array elements,
// except the last one. The startScan variable marks the
// position where the scan should begin.
for (int startScan = 0; startScan < sArray.Length - 1; startScan++)
{
// Assume the first element in the scannable area
// is the minimum value.
minIndex = startScan;
minValue = sArray[startScan];

// Scan the array, starting at the 2nd element in the
// scannable area, looking for the minimum value.
for (int index = startScan + 1; index < sArray.Length; index++)
{
if (string.Compare(sArray[index], minValue, true) < 0)
{
minValue = sArray[index];
minIndex = index;
}
}

// Swap the element with the lesser value with the
// first element in the scannable area.
Swap(ref sArray[minIndex], ref sArray[startScan]);
}
}
// The SelectionSort method accepts a string array as an argument.
// It uses the Selection Sort algorithm to sort the array.
private void SelectionSort(string[] sArray)
{

int minIndex; // Subscript of minimum value in scanned area
string minValue; // Minimum value in the scanned area

// The outer loop steps through all the array elements,
// except the last one. The startScan variable marks the
// position where the scan should begin.
for (int startScan = 0; startScan < sArray.Length - 1; startScan++)
{
// Assume the first element in the scannable area
// is the minimum value.
minIndex = startScan;
minValue = sArray[startScan];

// Scan the array, starting at the 2nd element in the
// scannable area, looking for the minimum value.
for (int index = startScan + 1; index < sArray.Length; index++)
{
if (string.Compare(sArray[index], minValue, true) < 0)
{
minValue = sArray[index];
minIndex = index;
}
}

// Swap the element with the lesser value with the
// first element in the scannable area.
Swap(ref sArray[minIndex], ref sArray[startScan]);
}
}
I'm mostly confused about the if statement. What is happening there?
20 replies
CC#
Created by Grin on 11/30/2022 in #help
✅ Can someone help me figure out how to write the quadratic formula? I keep getting an error
10 replies
CC#
Created by Grin on 11/28/2022 in #help
✅ Is it possible to create a new repository after pulling some code?
I recently edited a program I made and want to create an entirely new repository with a new name. But the only options I seem to have are to commit all. How can I create a new repository without altering the old repository I had?
19 replies
CC#
Created by Grin on 11/28/2022 in #help
✅ How can I change the directory of a file for Visual Studio?
11 replies
CC#
Created by Grin on 11/28/2022 in #help
✅ How do I make an exponent in winforms?
7 replies
CC#
Created by Grin on 11/22/2022 in #help
❔ Is it possible to make the gui ratio change when switching to another monitor?
Been making scripts with winforms and have noticed when I switch from my tower to my laptop and run a script the gui looks bad (buttons appear slightly over text boxes & stuff) is there any way to fix this?
2 replies
CC#
Created by Grin on 11/20/2022 in #help
What does [..^1] represent in this line of code? [Answered]
var allWithoutLastChar = txtBox_Calculation.Text[..^1];
13 replies
CC#
Created by Grin on 11/19/2022 in #help
Is it possible to subtract a character from a string?
I've found that I can add strings, but can't figure out how to subtract strings, or characters from strings. Is there a function already in existence that can erase a character from a string, or replace the index of a string with a letter?
24 replies
CC#
Created by Grin on 11/19/2022 in #help
How to call a function when you don't know what function to call?
32 replies
CC#
Created by Grin on 11/18/2022 in #help
Is it possible to create a text box that receives data from right to left? [Answered]
Imagine if you had to solve a problem like 57281 * 38268 Don't use a calculator, when you start writing down the answer do you start from the right and go left, or start from the left and go right? Whenever you enter information into a textbox for winforms the text always goes left to right, is there a way to change this?
68 replies
CC#
Created by Grin on 11/17/2022 in #help
❔ How do I pull information out of a function with alot of information?
I'm getting an error in the below statement SPECIFICALLY at keySet with the error "the name 'keySet' does not exist in the current context" foreach (var iteration in keySet) { } break; I'm storing the keySet inside of another public function, I'm not sure how to get the information out of that function and into this foreach statement. Heres an example of the other the other function public void Form1_Load(object sender, EventArgs e) { List<keyRing> keySet = new List<keyRing>(); //creating the list of key rings //creating ALL key rings manually entering information keySet.Add(new keyRing { keyRingIdentifier = "L1.6", numberOfKeys = 2, KeyLocation = "storage Building", keyIdentifier = new[] { "146.23", "72.32" }, keyDescription = new[] { "locker room", "control room" }, });
80 replies
CC#
Created by Grin on 11/17/2022 in #help
How do I create a class with an array within it?
I'm trying to create a class for people with an array of hobbies within it, but cannot figure out how to do that, can anyone tell me how I can go about doing this? internal class person { public string name { get; set; } public int age { get; set; } public int numberOfHobbies { get; set; } //how do I do an array? //public string[numberOfHobbies] hobbies { get; set; } }
7 replies